← All changes
|
includes/admin/campaigns/charitable-admin-campaign-hooks.php
+44
-4
1.6.8
→
1.8.13
View file →
| @@ -4,13 +4,13 @@ | ||
| 4 | 4 | * |
| 5 | 5 | * Action/filter hooks used for setting up donations in the admin. |
| 6 | 6 | * |
| 7 | 7 | * @package Charitable/Functions/Admin |
| 8 | - * @author Eric Daams | |
| 9 | - * @copyright Copyright (c) 2019, Studio 164a | |
| 8 | + * @author David Bisset | |
| 9 | + * @copyright Copyright (c) 2023, WP Charitable LLC | |
| 10 | 10 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 11 | 11 | * @since 1.5.0 |
| 12 | - * @version 1.6.0 | |
| 12 | + * @version 1.6.24, 1.8.9.1 | |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | // Exit if accessed directly. |
| 16 | 16 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -16,9 +16,9 @@ | ||
| 16 | 16 | if ( ! defined( 'ABSPATH' ) ) { |
| 17 | 17 | exit; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -$registry = charitable()->registry(); | |
| 20 | +$registry = charitable()->registry(); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- $registry is used in multiple add_action/add_filter hooks throughout this file. Changing it would break hook registrations. | |
| 21 | 21 | $registry->register_object( Charitable_Campaign_Meta_Boxes::get_instance() ); |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Sets the placeholder text of the campaign title field. |
| @@ -34,8 +34,13 @@ | ||
| 34 | 34 | */ |
| 35 | 35 | add_action( 'edit_form_after_title', array( $registry->get( 'campaign_meta_boxes' ), 'campaign_form_top' ) ); |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | + * Prevent meta box sorting for campaigns. | |
| 39 | + */ | |
| 40 | +add_filter( 'get_user_option_meta-box-order_' . Charitable::CAMPAIGN_POST_TYPE, '__return_false' ); | |
| 41 | + | |
| 42 | +/** | |
| 38 | 43 | * Campaign Metaboxes. |
| 39 | 44 | * |
| 40 | 45 | * @see Charitable_Campaign_Meta_Boxes::add_meta_boxes() |
| 41 | 46 | * @see Charitable_Campaign_Meta_Boxes::campaign_donation_options_metabox() |
| @@ -81,8 +86,15 @@ | ||
| 81 | 86 | */ |
| 82 | 87 | add_filter( 'bulk_post_updated_messages', array( Charitable_Campaign_List_Table::get_instance(), 'bulk_messages' ), 10, 2 ); |
| 83 | 88 | |
| 84 | 89 | /** |
| 90 | + * Add date-based filters above the campaigns table. | |
| 91 | + * | |
| 92 | + * @see Charitable_Campaign_List_Table::add_filters() | |
| 93 | + */ | |
| 94 | +add_action( 'restrict_manage_posts', array( Charitable_Campaign_List_Table::get_instance(), 'add_filters' ), 99 ); | |
| 95 | + | |
| 96 | +/** | |
| 85 | 97 | * Add the export button above the campaigns table. |
| 86 | 98 | * |
| 87 | 99 | * @see Charitable_Campaign_List_Table::add_export() |
| 88 | 100 | */ |
| @@ -100,4 +112,32 @@ | ||
| 100 | 112 | * |
| 101 | 113 | * @see Charitable_Campaign_List_Table::load_scripts() |
| 102 | 114 | */ |
| 103 | 115 | add_action( 'admin_enqueue_scripts', array( Charitable_Campaign_List_Table::get_instance(), 'load_scripts' ), 11 ); |
| 116 | + | |
| 117 | +/** | |
| 118 | + * Add custom filters to the query that returns the campaigns to be displayed. | |
| 119 | + * | |
| 120 | + * @see Charitable_Campaign_List_Table::filter_request_query() | |
| 121 | + */ | |
| 122 | +add_filter( 'request', array( Charitable_Campaign_List_Table::get_instance(), 'filter_request_query' ) ); | |
| 123 | + | |
| 124 | +/** | |
| 125 | + * Add custom css to body for campaign page. | |
| 126 | + * | |
| 127 | + * @see Charitable_Campaign_List_Table::admin_body_class() | |
| 128 | + */ | |
| 129 | +add_filter( 'admin_body_class', array( Charitable_Campaign_List_Table::get_instance(), 'admin_body_class' ) ); | |
| 130 | + | |
| 131 | +/** | |
| 132 | + * Add the legacy add button above the campaigns table. | |
| 133 | + * | |
| 134 | + * @see Charitable_Campaign_List_Table::add_export() | |
| 135 | + */ | |
| 136 | +add_action( 'manage_posts_extra_tablenav', array( Charitable_Campaign_List_Table::get_instance(), 'add_legacy_link' ) ); | |
| 137 | + | |
| 138 | +/** | |
| 139 | + * Set the content of each column item. | |
| 140 | + * | |
| 141 | + * @see Charitable_Campaign_List_Table::maybe_render_blank_state() | |
| 142 | + */ | |
| 143 | +add_action( 'manage_posts_extra_tablenav', array( Charitable_Campaign_List_Table::get_instance(), 'maybe_render_blank_state' ), 11, 2 ); | |