class-give-form-duplicator.php
3 years ago
class-metabox-form-data.php
1 year ago
dashboard-columns.php
1 year ago
metabox.php
6 years ago
dashboard-columns.php
587 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Dashboard Columns |
| 4 | * |
| 5 | * @package GIVE |
| 6 | * @subpackage Admin/Forms |
| 7 | * @copyright Copyright (c) 2016, GiveWP |
| 8 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
| 9 | * @since 1.0 |
| 10 | */ |
| 11 | |
| 12 | // Exit if accessed directly. |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit; |
| 15 | } |
| 16 | |
| 17 | |
| 18 | /** |
| 19 | * Give Forms Columns |
| 20 | * |
| 21 | * Defines the custom columns and their order |
| 22 | * |
| 23 | * @since 1.0 |
| 24 | * |
| 25 | * @param array $give_form_columns Array of forms columns |
| 26 | * |
| 27 | * @return array $form_columns Updated array of forms columns |
| 28 | * Post Type List Table |
| 29 | */ |
| 30 | function give_form_columns( $give_form_columns ) { |
| 31 | |
| 32 | // Standard columns |
| 33 | $give_form_columns = [ |
| 34 | 'cb' => '<input type="checkbox"/>', |
| 35 | 'title' => __( 'Name', 'give' ), |
| 36 | 'form_category' => __( 'Categories', 'give' ), |
| 37 | 'form_tag' => __( 'Tags', 'give' ), |
| 38 | 'price' => __( 'Amount', 'give' ), |
| 39 | 'goal' => __( 'Goal', 'give' ), |
| 40 | 'donations' => __( 'Donations', 'give' ), |
| 41 | 'earnings' => __( 'Revenue', 'give' ), |
| 42 | 'shortcode' => __( 'Shortcode', 'give' ), |
| 43 | 'date' => __( 'Date', 'give' ), |
| 44 | ]; |
| 45 | |
| 46 | // Does the user want categories / tags? |
| 47 | if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) { |
| 48 | unset( $give_form_columns['form_category'] ); |
| 49 | } |
| 50 | if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) { |
| 51 | unset( $give_form_columns['form_tag'] ); |
| 52 | } |
| 53 | |
| 54 | return apply_filters( 'give_forms_columns', $give_form_columns ); |
| 55 | } |
| 56 | |
| 57 | add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' ); |
| 58 | |
| 59 | /** |
| 60 | * Render Give Form Columns |
| 61 | * |
| 62 | * @since 3.16.0 Add new filters for the "donations count" and "revenue" columns |
| 63 | * @since 1.0 |
| 64 | * |
| 65 | * @param string $column_name Column name |
| 66 | * @param int $post_id Give Form (Post) ID |
| 67 | * |
| 68 | * @return void |
| 69 | */ |
| 70 | function give_render_form_columns( $column_name, $post_id ) { |
| 71 | if ( get_post_type( $post_id ) == 'give_forms' ) { |
| 72 | |
| 73 | switch ( $column_name ) { |
| 74 | case 'form_category': |
| 75 | echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' ); |
| 76 | break; |
| 77 | case 'form_tag': |
| 78 | echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' ); |
| 79 | break; |
| 80 | case 'price': |
| 81 | if ( give_has_variable_prices( $post_id ) ) { |
| 82 | echo give_price_range( $post_id ); |
| 83 | } else { |
| 84 | echo give_price( $post_id, false ); |
| 85 | printf( '<input type="hidden" class="formprice-%1$s" value="%2$s" />', esc_attr( $post_id ), esc_attr( give_get_form_price( $post_id ) ) ); |
| 86 | } |
| 87 | break; |
| 88 | case 'goal': |
| 89 | if ( give_is_setting_enabled( give_get_meta( $post_id, '_give_goal_option', true ) ) ) { |
| 90 | do_action('give_admin_form_list_view_donations_goal_column_before', $post_id); |
| 91 | |
| 92 | echo give_admin_form_goal_stats( $post_id ); |
| 93 | |
| 94 | } else { |
| 95 | _e( 'No Goal Set', 'give' ); |
| 96 | } |
| 97 | |
| 98 | printf( |
| 99 | '<input type="hidden" class="formgoal-%1$s" value="%2$s" />', |
| 100 | esc_attr( $post_id ), |
| 101 | give_get_form_goal( $post_id ) |
| 102 | ); |
| 103 | |
| 104 | break; |
| 105 | case 'donations': |
| 106 | if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
| 107 | printf( |
| 108 | '<a href="%1$s">%2$s</a>', |
| 109 | esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . $post_id ) ), |
| 110 | apply_filters('give_admin_form_list_view_donations_count_column_value', give_get_form_sales_stats( $post_id ), $post_id) |
| 111 | ); |
| 112 | } else { |
| 113 | echo '-'; |
| 114 | } |
| 115 | break; |
| 116 | case 'earnings': |
| 117 | if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
| 118 | printf( |
| 119 | '<a href="%1$s">%2$s</a>', |
| 120 | esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $post_id ) ), |
| 121 | apply_filters('give_admin_form_list_view_revenue_column_value', give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ), [ 'sanitize' => false ] ) ), $post_id) |
| 122 | ); |
| 123 | } else { |
| 124 | echo '-'; |
| 125 | } |
| 126 | break; |
| 127 | case 'shortcode': |
| 128 | $shortcode = sprintf( '[give_form id="%s"]', absint( $post_id ) ); |
| 129 | printf( |
| 130 | '<button |
| 131 | type="button" |
| 132 | class="button hint-tooltip hint--top js-give-shortcode-button" |
| 133 | aria-label="%1$s" |
| 134 | data-give-shortcode="%2$s"> |
| 135 | <span class="dashicons dashicons-admin-page"></span> |
| 136 | <span class="give-button-text"> %3$s</span> |
| 137 | </button>', |
| 138 | esc_attr( $shortcode ), |
| 139 | esc_attr( $shortcode ), |
| 140 | esc_html__( 'Copy Shortcode', 'give' ) |
| 141 | ); |
| 142 | break; |
| 143 | }// End switch(). |
| 144 | }// End if(). |
| 145 | } |
| 146 | |
| 147 | add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 ); |
| 148 | |
| 149 | /** |
| 150 | * Registers the sortable columns in the list table |
| 151 | * |
| 152 | * @since 1.0 |
| 153 | * |
| 154 | * @param array $columns Array of the columns |
| 155 | * |
| 156 | * @return array $columns Array of sortable columns |
| 157 | */ |
| 158 | function give_sortable_form_columns( $columns ) { |
| 159 | $columns['price'] = 'amount'; |
| 160 | $columns['sales'] = 'sales'; |
| 161 | $columns['earnings'] = 'earnings'; |
| 162 | $columns['goal'] = 'goal'; |
| 163 | $columns['donations'] = 'donations'; |
| 164 | |
| 165 | return $columns; |
| 166 | } |
| 167 | |
| 168 | add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' ); |
| 169 | |
| 170 | /** |
| 171 | * Sorts Columns in the Forms List Table |
| 172 | * |
| 173 | * @since 3.16.0 Remove "give_donate_form_get_sales" filter logic |
| 174 | * @since 3.14.0 Use the "give_donate_form_get_sales" filter to ensure the correct donation count will be used |
| 175 | * @since 1.0 |
| 176 | * |
| 177 | * @param array $vars Array of all the sort variables. |
| 178 | * |
| 179 | * @return array $vars Array of all the sort variables. |
| 180 | */ |
| 181 | function give_sort_forms( $vars ) { |
| 182 | // Check if we're viewing the "give_forms" post type. |
| 183 | if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) { |
| 184 | return $vars; |
| 185 | } |
| 186 | |
| 187 | switch ( $vars['orderby'] ) { |
| 188 | // Check if 'orderby' is set to "sales". |
| 189 | case 'sales': |
| 190 | $vars = array_merge( |
| 191 | $vars, |
| 192 | [ |
| 193 | 'meta_key' => '_give_form_sales', |
| 194 | 'orderby' => 'meta_value_num', |
| 195 | ] |
| 196 | ); |
| 197 | break; |
| 198 | |
| 199 | // Check if "orderby" is set to "earnings". |
| 200 | case 'earnings': |
| 201 | $vars = array_merge( |
| 202 | $vars, |
| 203 | [ |
| 204 | 'meta_key' => '_give_form_earnings', |
| 205 | 'orderby' => 'meta_value_num', |
| 206 | ] |
| 207 | ); |
| 208 | break; |
| 209 | |
| 210 | // Check if "orderby" is set to "price/amount". |
| 211 | case 'amount': |
| 212 | $multi_level_meta_key = ( 'asc' === $vars['order'] ) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount'; |
| 213 | |
| 214 | $vars['orderby'] = 'meta_value_num'; |
| 215 | $vars['meta_query'] = [ |
| 216 | 'relation' => 'OR', |
| 217 | [ |
| 218 | 'key' => $multi_level_meta_key, |
| 219 | 'type' => 'NUMERIC', |
| 220 | ], |
| 221 | [ |
| 222 | 'key' => '_give_set_price', |
| 223 | 'type' => 'NUMERIC', |
| 224 | ], |
| 225 | ]; |
| 226 | |
| 227 | break; |
| 228 | |
| 229 | // Check if "orderby" is set to "goal". |
| 230 | case 'goal': |
| 231 | $meta_key = give_has_upgrade_completed( 'v240_update_form_goal_progress' ) |
| 232 | ? '_give_form_goal_progress' |
| 233 | : '_give_set_goal'; // Backward compatibility |
| 234 | |
| 235 | $vars = array_merge( |
| 236 | $vars, |
| 237 | [ |
| 238 | 'meta_key' => $meta_key, |
| 239 | 'orderby' => 'meta_value_num', |
| 240 | ] |
| 241 | ); |
| 242 | break; |
| 243 | |
| 244 | // Check if "orderby" is set to "donations". |
| 245 | case 'donations': |
| 246 | $vars = array_merge( |
| 247 | $vars, |
| 248 | [ |
| 249 | 'meta_key' => '_give_form_sales', |
| 250 | 'orderby' => 'meta_value_num', |
| 251 | ] |
| 252 | ); |
| 253 | break; |
| 254 | }// End switch(). |
| 255 | |
| 256 | return $vars; |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * Sets restrictions on author of Forms List Table |
| 261 | * |
| 262 | * @since 1.0 |
| 263 | * |
| 264 | * @param array $vars Array of all sort variables. |
| 265 | * |
| 266 | * @return array Array of all sort variables. |
| 267 | */ |
| 268 | function give_filter_forms( $vars ) { |
| 269 | if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) { |
| 270 | |
| 271 | // If an author ID was passed, use it |
| 272 | if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) { |
| 273 | |
| 274 | $author_id = $_REQUEST['author']; |
| 275 | if ( (int) $author_id !== get_current_user_id() ) { |
| 276 | wp_die( |
| 277 | esc_html__( 'You do not have permission to view this data.', 'give' ), |
| 278 | esc_html__( 'Error', 'give' ), |
| 279 | [ |
| 280 | 'response' => 403, |
| 281 | ] |
| 282 | ); |
| 283 | } |
| 284 | $vars = array_merge( |
| 285 | $vars, |
| 286 | [ |
| 287 | 'author' => get_current_user_id(), |
| 288 | ] |
| 289 | ); |
| 290 | |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | return $vars; |
| 295 | } |
| 296 | |
| 297 | /** |
| 298 | * Form Load |
| 299 | * |
| 300 | * Sorts the form columns. |
| 301 | * |
| 302 | * @since 1.0 |
| 303 | * @return void |
| 304 | */ |
| 305 | function give_forms_load() { |
| 306 | add_filter( 'request', 'give_sort_forms' ); |
| 307 | add_filter( 'request', 'give_filter_forms' ); |
| 308 | } |
| 309 | |
| 310 | add_action( 'load-edit.php', 'give_forms_load', 9999 ); |
| 311 | |
| 312 | /** |
| 313 | * Remove Forms Month Filter |
| 314 | * |
| 315 | * Removes the default drop down filter for forms by date. |
| 316 | * |
| 317 | * @since 1.0 |
| 318 | * |
| 319 | * @param array $dates The preset array of dates. |
| 320 | * |
| 321 | * @global $typenow The post type we are viewing. |
| 322 | * @return array Empty array disables the dropdown. |
| 323 | */ |
| 324 | function give_remove_month_filter( $dates ) { |
| 325 | global $typenow; |
| 326 | |
| 327 | if ( $typenow == 'give_forms' ) { |
| 328 | $dates = []; |
| 329 | } |
| 330 | |
| 331 | return $dates; |
| 332 | } |
| 333 | |
| 334 | add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 ); |
| 335 | |
| 336 | /** |
| 337 | * Updates price when saving post |
| 338 | * |
| 339 | * @since 1.0 |
| 340 | * @since 2.1.4 If the donation amount is less than the Minimum amount then set the donation amount as Donation minimum amount. |
| 341 | * |
| 342 | * @param int $post_id Download (Post) ID |
| 343 | * |
| 344 | * @return int|null |
| 345 | */ |
| 346 | function give_price_save_quick_edit( $post_id ) { |
| 347 | if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) { |
| 348 | return; |
| 349 | } |
| 350 | if ( ! current_user_can( 'edit_post', $post_id ) ) { |
| 351 | return $post_id; |
| 352 | } |
| 353 | if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
| 354 | return $post_id; |
| 355 | } |
| 356 | |
| 357 | if ( isset( $_REQUEST['_give_regprice'] ) ) { |
| 358 | give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ) ); |
| 359 | } |
| 360 | |
| 361 | // Override the Donation minimum amount. |
| 362 | if ( |
| 363 | isset( $_REQUEST['_give_custom_amount'], $_REQUEST['_give_set_price'], $_REQUEST['_give_price_option'], $_REQUEST['_give_custom_amount_range'] ) |
| 364 | && 'set' === $_REQUEST['_give_price_option'] |
| 365 | && give_is_setting_enabled( $_REQUEST['_give_custom_amount'] ) |
| 366 | && give_maybe_sanitize_amount( $_REQUEST['_give_set_price'] ) < give_maybe_sanitize_amount( $_REQUEST['_give_custom_amount_range']['minimum'] ) |
| 367 | ) { |
| 368 | give_update_meta( $post_id, '_give_custom_amount_range_minimum', give_sanitize_amount_for_db( $_REQUEST['_give_set_price'] ) ); |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | add_action( 'save_post', 'give_price_save_quick_edit' ); |
| 373 | |
| 374 | /** |
| 375 | * Function is used to filter the query for search result. |
| 376 | * |
| 377 | * @since 2.4.0 |
| 378 | * |
| 379 | * @param $wp WP WordPress environment instance (passed by reference). |
| 380 | */ |
| 381 | function give_form_search_query_filter( $wp ) { |
| 382 | |
| 383 | if ( |
| 384 | isset( $wp->query_vars['post_type'] ) |
| 385 | && 'give_forms' == $wp->query_vars['post_type'] |
| 386 | && isset( $_GET['give-forms-goal-filter'] ) |
| 387 | ) { |
| 388 | |
| 389 | $wp->query_vars['date_query'] = |
| 390 | [ |
| 391 | 'after' => ! empty( $_GET['start-date'] ) ? date( 'Y-m-d', strtotime( give_clean( $_GET['start-date'] ) ) ) : false, |
| 392 | 'before' => ! empty( $_GET['end-date'] ) ? date( 'Y-m-d 23:59:59 ', strtotime( give_clean( $_GET['end-date'] ) ) ) : false, |
| 393 | 'inclusive' => true, |
| 394 | ]; |
| 395 | switch ( $_GET['give-forms-goal-filter'] ) { |
| 396 | case 'goal_in_progress': |
| 397 | $wp->query_vars['meta_query'] = |
| 398 | [ |
| 399 | 'relation' => 'AND', |
| 400 | [ |
| 401 | 'key' => '_give_form_goal_progress', |
| 402 | 'value' => [ 1, 99 ], |
| 403 | 'compare' => 'BETWEEN', |
| 404 | 'type' => 'NUMERIC', |
| 405 | ], |
| 406 | ]; |
| 407 | |
| 408 | break; |
| 409 | case 'goal_achieved': |
| 410 | $wp->query_vars['meta_query'] = |
| 411 | [ |
| 412 | 'relation' => 'AND', |
| 413 | [ |
| 414 | 'key' => '_give_form_goal_progress', |
| 415 | 'value' => 100, |
| 416 | 'compare' => '>=', |
| 417 | 'type' => 'NUMERIC', |
| 418 | ], |
| 419 | ]; |
| 420 | break; |
| 421 | case 'goal_not_set': |
| 422 | $wp->query_vars['meta_query'] = |
| 423 | [ |
| 424 | 'relation' => 'OR', |
| 425 | [ |
| 426 | 'key' => '_give_goal_option', |
| 427 | 'value' => 'disabled', |
| 428 | 'compare' => '=', |
| 429 | ], |
| 430 | [ |
| 431 | 'key' => '_give_goal_option', |
| 432 | 'compare' => 'NOT EXISTS', |
| 433 | ], |
| 434 | ]; |
| 435 | break; |
| 436 | } |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | add_action( 'parse_request', 'give_form_search_query_filter' ); |
| 441 | |
| 442 | /** |
| 443 | * function is used to search give forms by ID or title. |
| 444 | * |
| 445 | * @since 2.4.0 |
| 446 | * |
| 447 | * @param $query WP_Query the WP_Query instance (passed by reference). |
| 448 | */ |
| 449 | |
| 450 | function give_search_form_by_id( $query ) { |
| 451 | // Verify that we are on the give forms list page. |
| 452 | if ( |
| 453 | empty( $query->query_vars['post_type'] ) |
| 454 | || 'give_forms' !== $query->query_vars['post_type'] |
| 455 | ) { |
| 456 | return; |
| 457 | } |
| 458 | |
| 459 | if ( '' !== $query->query_vars['s'] && is_search() ) { |
| 460 | if ( absint( $query->query_vars['s'] ) ) { |
| 461 | // Set the post id value |
| 462 | $query->set( 'p', $query->query_vars['s'] ); |
| 463 | // Reset the search value |
| 464 | $query->set( 's', '' ); |
| 465 | } |
| 466 | } |
| 467 | } |
| 468 | |
| 469 | add_filter( 'pre_get_posts', 'give_search_form_by_id' ); |
| 470 | |
| 471 | /** |
| 472 | * Outputs advanced filter html in Give forms list admin screen. |
| 473 | * |
| 474 | * @sicne 2.4.0 |
| 475 | * |
| 476 | * @param $which |
| 477 | */ |
| 478 | function give_forms_advanced_filter( $which ) { |
| 479 | /* @var stdClass $screen */ |
| 480 | $screen = get_current_screen(); |
| 481 | |
| 482 | if ( 'edit' !== $screen->parent_base || 'give_forms' !== $screen->post_type ) { |
| 483 | return; |
| 484 | } |
| 485 | |
| 486 | // Apply this only on a specific post type |
| 487 | if ( 'top' !== $which ) { |
| 488 | return; |
| 489 | } |
| 490 | |
| 491 | $start_date = isset( $_GET['start-date'] ) ? strtotime( give_clean( $_GET['start-date'] ) ) : ''; |
| 492 | $end_date = isset( $_GET['end-date'] ) ? strtotime( give_clean( $_GET['end-date'] ) ) : ''; |
| 493 | $search = isset( $_GET['s'] ) ? give_clean( $_GET['s'] ) : ''; |
| 494 | $give_forms_goal_filter = isset( $_GET['give-forms-goal-filter'] ) ? $_GET['give-forms-goal-filter'] : ''; |
| 495 | ?> |
| 496 | <div id="give-forms-advanced-filter" class="give-filters"> |
| 497 | <div class="give-filter give-filter-search"> |
| 498 | <input type="text" id="give-forms-search-input" placeholder="<?php _e( 'Form Name or ID', 'give' ); ?>" name="s" value="<?php echo esc_attr( $search ); ?>"> |
| 499 | <?php |
| 500 | submit_button( |
| 501 | __( 'Search', 'give' ), |
| 502 | 'button', |
| 503 | false, |
| 504 | false, |
| 505 | [ |
| 506 | 'ID' => 'form-search-submit', |
| 507 | ] |
| 508 | ); |
| 509 | ?> |
| 510 | </div> |
| 511 | <div id="give-payment-date-filters"> |
| 512 | <div class="give-filter give-filter-half"> |
| 513 | <label for="start-date" |
| 514 | class="give-start-date-label"><?php _e( 'Start Date', 'give' ); ?></label> |
| 515 | <input type="text" |
| 516 | id="start-date" |
| 517 | name="start-date" |
| 518 | class="give_datepicker" |
| 519 | autocomplete="off" |
| 520 | value="<?php echo $start_date ? date_i18n( give_date_format(), $start_date ) : ''; ?>" |
| 521 | data-standard-date="<?php echo $start_date ? date( 'Y-m-d', $start_date ) : $start_date; ?>" |
| 522 | placeholder="<?php _e( 'Start Date', 'give' ); ?>" |
| 523 | /> |
| 524 | </div> |
| 525 | <div class="give-filter give-filter-half"> |
| 526 | <label for="end-date" class="give-end-date-label"><?php _e( 'End Date', 'give' ); ?></label> |
| 527 | <input type="text" |
| 528 | id="end-date" |
| 529 | name="end-date" |
| 530 | class="give_datepicker" |
| 531 | autocomplete="off" |
| 532 | value="<?php echo $end_date ? date_i18n( give_date_format(), $end_date ) : ''; ?>" |
| 533 | data-standard-date="<?php echo $end_date ? date( 'Y-m-d', $end_date ) : $end_date; ?>" |
| 534 | placeholder="<?php _e( 'End Date', 'give' ); ?>" |
| 535 | /> |
| 536 | </div> |
| 537 | </div> |
| 538 | <div id="give-payment-form-filter" class="give-filter"> |
| 539 | <label for="give-donation-forms-filter" |
| 540 | class="give-donation-forms-filter-label"><?php _e( 'Goal', 'give' ); ?></label> |
| 541 | <select id="give-forms-goal-filter" name="give-forms-goal-filter" class="give-forms-goal-filter"> |
| 542 | <option value="any_goal_status" |
| 543 | <?php |
| 544 | if ( 'any_goal_status' === $give_forms_goal_filter ) { |
| 545 | echo 'selected'; |
| 546 | } |
| 547 | ?> |
| 548 | ><?php _e( 'Any Goal Status', 'give' ); ?></option> |
| 549 | <option value="goal_achieved" |
| 550 | <?php |
| 551 | if ( 'goal_achieved' === $give_forms_goal_filter ) { |
| 552 | echo 'selected'; |
| 553 | } |
| 554 | ?> |
| 555 | ><?php _e( 'Goal Achieved', 'give' ); ?></option> |
| 556 | <option value="goal_in_progress" |
| 557 | <?php |
| 558 | if ( 'goal_in_progress' === $give_forms_goal_filter ) { |
| 559 | echo 'selected'; |
| 560 | } |
| 561 | ?> |
| 562 | ><?php _e( 'Goal In Progress', 'give' ); ?></option> |
| 563 | <option value="goal_not_set" |
| 564 | <?php |
| 565 | if ( 'goal_not_set' === $give_forms_goal_filter ) { |
| 566 | echo 'selected'; |
| 567 | } |
| 568 | ?> |
| 569 | ><?php _e( 'Goal Not Set', 'give' ); ?></option> |
| 570 | </select> |
| 571 | </div> |
| 572 | <div class="give-filter"> |
| 573 | <?php submit_button( __( 'Apply', 'give' ), 'secondary', '', false ); ?> |
| 574 | <?php |
| 575 | // Clear active filters button. |
| 576 | if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $search ) || ! empty( $give_forms_goal_filter ) ) : |
| 577 | ?> |
| 578 | <a href="<?php echo admin_url( 'edit.php?post_type=give_forms' ); ?>" |
| 579 | class="button give-clear-filters-button"><?php _e( 'Clear Filters', 'give' ); ?></a> |
| 580 | <?php endif; ?> |
| 581 | </div> |
| 582 | </div> |
| 583 | <?php |
| 584 | } |
| 585 | |
| 586 | add_action( 'manage_posts_extra_tablenav', 'give_forms_advanced_filter', 10, 1 ); |
| 587 |