Skip to content

Courier

linchpin edited this page Feb 22, 2023 · 10 revisions

Courier

Courier Class

  • Full name: \CourierNotices\Controller\Courier

Methods

register_actions

Register the hooks and filters

public register_actions(): mixed

remove_editor_styles

Remove editor styles when viewing a Courier Notice in the admin

public remove_editor_styles(): mixed

This is needed for BOTH the classic editor as well as when utilizing the Block editor.


add_expired_status

Adds a custom post status for expired notices

public add_expired_status(): mixed

post_updated_messages

Post updated messages

public post_updated_messages(array $messages): mixed

Parameters:

Parameter Type Description
$messages array Array of messages.

views_addition

Add a links for global and expired notices in the admin table view.

public views_addition(array $views): array

Parameters:

Parameter Type Description
$views array Array of views.

get_scope_options

Get a list of available post types to select from.

private get_scope_options(): array|mixed|void

Return Value:

List of public/visible post types.


get_notice_selected_type

Get the currently selected type of notice.

public get_notice_selected_type(mixed $post_id): string

Parameters:

Parameter Type Description
$post_id mixed

save_post_courier_notice

Save our notice data

public save_post_courier_notice(int $post_id, object|array $post): mixed

Parameters:

Parameter Type Description
$post_id int The post ID.
$post object|array The post object.

wp_insert_post

When creating new notice for a specific user, log who created it.

public wp_insert_post(int $post_id, array|\WP_Post $post, bool $update): mixed

Parameters:

Parameter Type Description
$post_id int The post ID.
$post array|\WP_Post The post object.
$update bool Insert or Update flag.

query_vars

Add some custom query vars

public query_vars(array $vars): array

Parameters:

Parameter Type Description
$vars array Array of vars.

request

Force a login when trying to visit the notifications page

public request(array $vars): mixed

Parameters:

Parameter Type Description
$vars array Array of vars.

pre_get_posts

Use custom query vars to include specific scopes of notices

public pre_get_posts(object $query): mixed

Parameters:

Parameter Type Description
$query object Query object.

template_include

If a custom template exists in the current theme for notifications, use that one instead.

public template_include(string $template): string

Parameters:

Parameter Type Description
$template string The template to include.

document_title_parts

When viewing the notification page, filter the title.

public document_title_parts(mixed $title): mixed

Parameters:

Parameter Type Description
$title mixed The title.

post_class

Add classes for dismissed and global notice for notices.

public post_class(array $classes, string $class, int $post_id): array

Parameters:

Parameter Type Description
$classes array Array of classes.
$class string The class.
$post_id int The post ID.


Automatically generated from source code comments on 2023-02-22 using phpDocumentor and saggre/phpdocumentor-markdown