---
src/bp-core/admin/bp-core-admin-functions.php | 235 ++++++++++--------
1 file changed, 135 insertions(+), 100 deletions(-)
diff --git a/src/bp-core/admin/bp-core-admin-functions.php b/src/bp-core/admin/bp-core-admin-functions.php
index 2b6abea5f..8e19f2c12 100644
a
|
b
|
defined( 'ABSPATH' ) || exit; |
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Initializes the wp-admin area "BuddyPress" menus and sub menus. |
17 | | * |
18 | 17 | */ |
19 | 18 | function bp_core_admin_menu_init() { |
20 | 19 | add_action( bp_core_admin_hook(), 'bp_core_add_admin_menu', 9 ); |
… |
… |
function bp_core_modify_admin_menu_highlight() { |
77 | 76 | global $plugin_page, $submenu_file; |
78 | 77 | |
79 | 78 | // This tweaks the Settings subnav menu to show only one BuddyPress menu item. |
80 | | if ( ! in_array( $plugin_page, array( 'bp-activity', 'bp-general-settings', ) ) ) { |
| 79 | if ( ! in_array( $plugin_page, array( 'bp-activity', 'bp-general-settings' ) ) ) { |
81 | 80 | $submenu_file = 'bp-components'; |
82 | 81 | } |
83 | 82 | |
… |
… |
function bp_core_admin_backpat_page() { |
106 | 105 | <h2><?php _e( 'Why have all my BuddyPress menus disappeared?', 'buddypress' ); ?></h2> |
107 | 106 | |
108 | 107 | <p><?php _e( "Don't worry! We've moved the BuddyPress options into more convenient and easier to find locations. You're seeing this page because you are running a legacy BuddyPress plugin which has not been updated.", 'buddypress' ); ?></p> |
109 | | <p><?php printf( __( 'Components, Pages, Settings, and Forums, have been moved to <a href="%s">Settings > BuddyPress</a>. Profile Fields has been moved into the <a href="%s">Users</a> menu.', 'buddypress' ), esc_url( $settings_url ), bp_get_admin_url( 'users.php?page=bp-profile-setup' ) ); ?></p> |
| 108 | <p><?php printf( __( 'Components, Pages, Settings, and Forums, have been moved to <a href="%1$s">Settings > BuddyPress</a>. Profile Fields has been moved into the <a href="%2$s">Users</a> menu.', 'buddypress' ), esc_url( $settings_url ), bp_get_admin_url( 'users.php?page=bp-profile-setup' ) ); ?></p> |
110 | 109 | </div> |
111 | 110 | |
112 | 111 | <?php |
… |
… |
function bp_core_admin_backpat_page() { |
121 | 120 | * boxes. |
122 | 121 | * |
123 | 122 | * @since 1.5.0 |
124 | | * |
125 | 123 | */ |
126 | 124 | function bp_core_print_admin_notices() { |
127 | 125 | |
… |
… |
function bp_core_print_admin_notices() { |
153 | 151 | printf( '</div>' ); |
154 | 152 | } |
155 | 153 | } |
156 | | add_action( 'admin_notices', 'bp_core_print_admin_notices' ); |
| 154 | add_action( 'admin_notices', 'bp_core_print_admin_notices' ); |
157 | 155 | add_action( 'network_admin_notices', 'bp_core_print_admin_notices' ); |
158 | 156 | |
159 | 157 | /** |
… |
… |
function bp_core_activation_notice() { |
253 | 251 | $wp_page_components = array(); |
254 | 252 | |
255 | 253 | // Only components with 'has_directory' require a WP page to function. |
256 | | foreach( array_keys( $bp->loaded_components ) as $component_id ) { |
257 | | if ( !empty( $bp->{$component_id}->has_directory ) ) { |
| 254 | foreach ( array_keys( $bp->loaded_components ) as $component_id ) { |
| 255 | if ( ! empty( $bp->{$component_id}->has_directory ) ) { |
258 | 256 | $wp_page_components[] = array( |
259 | 257 | 'id' => $component_id, |
260 | | 'name' => isset( $bp->{$component_id}->name ) ? $bp->{$component_id}->name : ucwords( $bp->{$component_id}->id ) |
| 258 | 'name' => isset( $bp->{$component_id}->name ) ? $bp->{$component_id}->name : ucwords( $bp->{$component_id}->id ), |
261 | 259 | ); |
262 | 260 | } |
263 | 261 | } |
… |
… |
function bp_core_activation_notice() { |
267 | 265 | if ( bp_get_signup_allowed() ) { |
268 | 266 | $wp_page_components[] = array( |
269 | 267 | 'id' => 'activate', |
270 | | 'name' => __( 'Activate', 'buddypress' ) |
| 268 | 'name' => __( 'Activate', 'buddypress' ), |
271 | 269 | ); |
272 | 270 | |
273 | 271 | $wp_page_components[] = array( |
274 | 272 | 'id' => 'register', |
275 | | 'name' => __( 'Register', 'buddypress' ) |
| 273 | 'name' => __( 'Register', 'buddypress' ), |
276 | 274 | ); |
277 | 275 | } |
278 | 276 | |
… |
… |
function bp_core_activation_notice() { |
282 | 280 | $bp->pages = bp_core_get_directory_pages(); |
283 | 281 | } |
284 | 282 | |
285 | | foreach( $wp_page_components as $component ) { |
286 | | if ( !isset( $bp->pages->{$component['id']} ) ) { |
| 283 | foreach ( $wp_page_components as $component ) { |
| 284 | if ( ! isset( $bp->pages->{$component['id']} ) ) { |
287 | 285 | $orphaned_components[] = $component['name']; |
288 | 286 | } |
289 | 287 | } |
290 | 288 | |
291 | | if ( !empty( $orphaned_components ) ) { |
| 289 | if ( ! empty( $orphaned_components ) ) { |
292 | 290 | $admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ); |
293 | 291 | $notice = sprintf( |
294 | 292 | '%1$s <a href="%2$s">%3$s</a>', |
… |
… |
function bp_core_activation_notice() { |
308 | 306 | $page_ids = bp_core_get_directory_page_ids(); |
309 | 307 | $dupes = array_diff_assoc( $page_ids, array_unique( $page_ids ) ); |
310 | 308 | |
311 | | if ( !empty( $dupes ) ) { |
312 | | foreach( array_keys( $dupes ) as $dupe_component ) { |
| 309 | if ( ! empty( $dupes ) ) { |
| 310 | foreach ( array_keys( $dupes ) as $dupe_component ) { |
313 | 311 | $dupe_names[] = $bp->pages->{$dupe_component}->title; |
314 | 312 | } |
315 | 313 | |
… |
… |
function bp_core_activation_notice() { |
318 | 316 | } |
319 | 317 | |
320 | 318 | // If there are duplicates, post a message about them. |
321 | | if ( !empty( $dupe_names ) ) { |
| 319 | if ( ! empty( $dupe_names ) ) { |
322 | 320 | $admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ); |
323 | 321 | $notice = sprintf( |
324 | 322 | '%1$s <a href="%2$s">%3$s</a>', |
… |
… |
function bp_core_activation_notice() { |
340 | 338 | * @since 1.7.0 |
341 | 339 | * |
342 | 340 | * @internal Used internally to redirect BuddyPress to the about page on activation. |
343 | | * |
344 | 341 | */ |
345 | 342 | function bp_do_activation_redirect() { |
346 | 343 | |
… |
… |
function bp_core_admin_tabs( $active_tab = '' ) { |
388 | 385 | * |
389 | 386 | * @param array $value Array of tabs to output to the admin area. |
390 | 387 | */ |
391 | | $tabs = apply_filters( 'bp_core_admin_tabs', bp_core_get_admin_tabs( $active_tab ) ); |
| 388 | $tabs = apply_filters( 'bp_core_admin_tabs', bp_core_get_admin_tabs( $active_tab ) ); |
392 | 389 | |
393 | 390 | // Loop through tabs and build navigation. |
394 | 391 | foreach ( array_values( $tabs ) as $tab_data ) { |
… |
… |
function bp_core_get_admin_tabs( $active_tab = '' ) { |
419 | 416 | $tabs = array( |
420 | 417 | '0' => array( |
421 | 418 | 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), 'admin.php' ) ), |
422 | | 'name' => __( 'Components', 'buddypress' ) |
| 419 | 'name' => __( 'Components', 'buddypress' ), |
423 | 420 | ), |
424 | 421 | '2' => array( |
425 | 422 | 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings' ), 'admin.php' ) ), |
426 | | 'name' => __( 'Options', 'buddypress' ) |
| 423 | 'name' => __( 'Options', 'buddypress' ), |
427 | 424 | ), |
428 | 425 | '1' => array( |
429 | 426 | 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ), |
430 | | 'name' => __( 'Pages', 'buddypress' ) |
| 427 | 'name' => __( 'Pages', 'buddypress' ), |
431 | 428 | ), |
432 | 429 | '3' => array( |
433 | 430 | 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-credits' ), 'admin.php' ) ), |
434 | | 'name' => __( 'Credits', 'buddypress' ) |
| 431 | 'name' => __( 'Credits', 'buddypress' ), |
435 | 432 | ), |
436 | 433 | ); |
437 | 434 | |
… |
… |
function bp_core_add_contextual_help( $screen = '' ) { |
462 | 459 | switch ( $screen->id ) { |
463 | 460 | |
464 | 461 | // Component page. |
465 | | case 'settings_page_bp-components' : |
466 | | |
| 462 | case 'settings_page_bp-components': |
467 | 463 | // Help tabs. |
468 | | $screen->add_help_tab( array( |
469 | | 'id' => 'bp-comp-overview', |
470 | | 'title' => __( 'Overview', 'buddypress' ), |
471 | | 'content' => bp_core_add_contextual_help_content( 'bp-comp-overview' ), |
472 | | ) ); |
| 464 | $screen->add_help_tab( |
| 465 | array( |
| 466 | 'id' => 'bp-comp-overview', |
| 467 | 'title' => __( 'Overview', 'buddypress' ), |
| 468 | 'content' => bp_core_add_contextual_help_content( 'bp-comp-overview' ), |
| 469 | ) |
| 470 | ); |
473 | 471 | |
474 | 472 | // Help panel - sidebar links. |
475 | 473 | $screen->set_help_sidebar( |
… |
… |
function bp_core_add_contextual_help( $screen = '' ) { |
480 | 478 | break; |
481 | 479 | |
482 | 480 | // Pages page. |
483 | | case 'settings_page_bp-page-settings' : |
484 | | |
| 481 | case 'settings_page_bp-page-settings': |
485 | 482 | // Help tabs. |
486 | | $screen->add_help_tab( array( |
487 | | 'id' => 'bp-page-overview', |
488 | | 'title' => __( 'Overview', 'buddypress' ), |
489 | | 'content' => bp_core_add_contextual_help_content( 'bp-page-overview' ), |
490 | | ) ); |
| 483 | $screen->add_help_tab( |
| 484 | array( |
| 485 | 'id' => 'bp-page-overview', |
| 486 | 'title' => __( 'Overview', 'buddypress' ), |
| 487 | 'content' => bp_core_add_contextual_help_content( 'bp-page-overview' ), |
| 488 | ) |
| 489 | ); |
491 | 490 | |
492 | 491 | // Help panel - sidebar links. |
493 | 492 | $screen->set_help_sidebar( |
… |
… |
function bp_core_add_contextual_help( $screen = '' ) { |
499 | 498 | break; |
500 | 499 | |
501 | 500 | // Settings page. |
502 | | case 'settings_page_bp-settings' : |
503 | | |
| 501 | case 'settings_page_bp-settings': |
504 | 502 | // Help tabs. |
505 | | $screen->add_help_tab( array( |
506 | | 'id' => 'bp-settings-overview', |
507 | | 'title' => __( 'Overview', 'buddypress' ), |
508 | | 'content' => bp_core_add_contextual_help_content( 'bp-settings-overview' ), |
509 | | ) ); |
| 503 | $screen->add_help_tab( |
| 504 | array( |
| 505 | 'id' => 'bp-settings-overview', |
| 506 | 'title' => __( 'Overview', 'buddypress' ), |
| 507 | 'content' => bp_core_add_contextual_help_content( 'bp-settings-overview' ), |
| 508 | ) |
| 509 | ); |
510 | 510 | |
511 | 511 | // Help panel - sidebar links. |
512 | 512 | $screen->set_help_sidebar( |
… |
… |
function bp_core_add_contextual_help( $screen = '' ) { |
518 | 518 | break; |
519 | 519 | |
520 | 520 | // Profile fields page. |
521 | | case 'users_page_bp-profile-setup' : |
522 | | |
| 521 | case 'users_page_bp-profile-setup': |
523 | 522 | // Help tabs. |
524 | | $screen->add_help_tab( array( |
525 | | 'id' => 'bp-profile-overview', |
526 | | 'title' => __( 'Overview', 'buddypress' ), |
527 | | 'content' => bp_core_add_contextual_help_content( 'bp-profile-overview' ), |
528 | | ) ); |
| 523 | $screen->add_help_tab( |
| 524 | array( |
| 525 | 'id' => 'bp-profile-overview', |
| 526 | 'title' => __( 'Overview', 'buddypress' ), |
| 527 | 'content' => bp_core_add_contextual_help_content( 'bp-profile-overview' ), |
| 528 | ) |
| 529 | ); |
529 | 530 | |
530 | 531 | // Help panel - sidebar links. |
531 | 532 | $screen->set_help_sidebar( |
… |
… |
add_action( 'load-users_page_bp-profile-setup', 'bp_core_add_contextual_help' ); |
553 | 554 | function bp_core_add_contextual_help_content( $tab = '' ) { |
554 | 555 | |
555 | 556 | switch ( $tab ) { |
556 | | case 'bp-comp-overview' : |
| 557 | case 'bp-comp-overview': |
557 | 558 | $retval = __( 'By default, all but four of the BuddyPress components are enabled. You can selectively enable or disable any of the components by using the form below. Your BuddyPress installation will continue to function. However, the features of the disabled components will no longer be accessible to anyone using the site.', 'buddypress' ); |
558 | 559 | break; |
559 | 560 | |
560 | | case 'bp-page-overview' : |
| 561 | case 'bp-page-overview': |
561 | 562 | $retval = __( 'BuddyPress Components use WordPress Pages for their root directory/archive pages. You can change the page associations for each active component by using the form below.', 'buddypress' ); |
562 | 563 | break; |
563 | 564 | |
564 | | case 'bp-settings-overview' : |
| 565 | case 'bp-settings-overview': |
565 | 566 | $retval = __( 'Extra configuration settings are provided and activated. You can selectively enable or disable any setting by using the form on this screen.', 'buddypress' ); |
566 | 567 | break; |
567 | 568 | |
568 | | case 'bp-profile-overview' : |
| 569 | case 'bp-profile-overview': |
569 | 570 | $retval = __( 'Your users will distinguish themselves through their profile page. Create relevant profile fields that will show on each users profile.', 'buddypress' ) . '<br /><br />' . __( 'Note: Any fields in the first group will appear on the signup page.', 'buddypress' ); |
570 | 571 | break; |
571 | 572 | |
… |
… |
function bp_core_add_contextual_help_content( $tab = '' ) { |
575 | 576 | } |
576 | 577 | |
577 | 578 | // Wrap text in a paragraph tag. |
578 | | if ( !empty( $retval ) ) { |
| 579 | if ( ! empty( $retval ) ) { |
579 | 580 | $retval = '<p>' . $retval . '</p>'; |
580 | 581 | } |
581 | 582 | |
… |
… |
function bp_core_add_contextual_help_content( $tab = '' ) { |
588 | 589 | * Add a separator to the WordPress admin menus. |
589 | 590 | * |
590 | 591 | * @since 1.7.0 |
591 | | * |
592 | 592 | */ |
593 | 593 | function bp_admin_separator() { |
594 | 594 | |
… |
… |
function bp_admin_menu_order( $menu_order = array() ) { |
655 | 655 | $bp_menu_order = array(); |
656 | 656 | |
657 | 657 | // Menu values. |
658 | | $last_sep = is_network_admin() ? 'separator1' : 'separator2'; |
| 658 | $last_sep = is_network_admin() ? 'separator1' : 'separator2'; |
659 | 659 | |
660 | 660 | /** |
661 | 661 | * Filters the custom admin menus. |
… |
… |
function bp_admin_menu_order( $menu_order = array() ) { |
681 | 681 | if ( $last_sep == $item ) { |
682 | 682 | |
683 | 683 | // Add our custom menus. |
684 | | foreach( (array) $custom_menus as $custom_menu ) { |
| 684 | foreach ( (array) $custom_menus as $custom_menu ) { |
685 | 685 | if ( array_search( $custom_menu, $menu_order ) ) { |
686 | 686 | $bp_menu_order[] = $custom_menu; |
687 | 687 | } |
… |
… |
function bp_admin_menu_order( $menu_order = array() ) { |
690 | 690 | // Add the appearance separator. |
691 | 691 | $bp_menu_order[] = $last_sep; |
692 | 692 | |
693 | | // Skip our menu items. |
| 693 | // Skip our menu items. |
694 | 694 | } elseif ( ! in_array( $item, $custom_menus ) ) { |
695 | 695 | $bp_menu_order[] = $item; |
696 | 696 | } |
… |
… |
function bp_admin_list_table_current_bulk_action() { |
718 | 718 | $action = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : ''; |
719 | 719 | |
720 | 720 | // If the bottom is set, let it override the action. |
721 | | if ( ! empty( $_REQUEST['action2'] ) && $_REQUEST['action2'] != "-1" ) { |
| 721 | if ( ! empty( $_REQUEST['action2'] ) && $_REQUEST['action2'] != '-1' ) { |
722 | 722 | $action = $_REQUEST['action2']; |
723 | 723 | } |
724 | 724 | |
… |
… |
function bp_admin_do_wp_nav_menu_meta_box() { |
759 | 759 | |
760 | 760 | $tabs = array(); |
761 | 761 | |
762 | | $tabs['loggedin']['label'] = __( 'Logged-In', 'buddypress' ); |
763 | | $tabs['loggedin']['pages'] = bp_nav_menu_get_loggedin_pages(); |
| 762 | $tabs['loggedin']['label'] = __( 'Logged-In', 'buddypress' ); |
| 763 | $tabs['loggedin']['pages'] = bp_nav_menu_get_loggedin_pages(); |
764 | 764 | |
765 | 765 | $tabs['loggedout']['label'] = __( 'Logged-Out', 'buddypress' ); |
766 | 766 | $tabs['loggedout']['pages'] = bp_nav_menu_get_loggedout_pages(); |
… |
… |
function bp_admin_do_wp_nav_menu_meta_box() { |
768 | 768 | ?> |
769 | 769 | |
770 | 770 | <div id="buddypress-menu" class="posttypediv"> |
771 | | <h4><?php _e( 'Logged-In', 'buddypress' ) ?></h4> |
772 | | <p><?php _e( '<em>Logged-In</em> links are relative to the current user, and are not visible to visitors who are not logged in.', 'buddypress' ) ?></p> |
| 771 | <h4><?php _e( 'Logged-In', 'buddypress' ); ?></h4> |
| 772 | <p><?php _e( '<em>Logged-In</em> links are relative to the current user, and are not visible to visitors who are not logged in.', 'buddypress' ); ?></p> |
773 | 773 | |
774 | 774 | <div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-loggedin" class="tabs-panel tabs-panel-active"> |
775 | 775 | <ul id="buddypress-menu-checklist-loggedin" class="categorychecklist form-no-clear"> |
776 | | <?php echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $tabs['loggedin']['pages'] ), 0, (object) $args );?> |
| 776 | <?php echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $tabs['loggedin']['pages'] ), 0, (object) $args ); ?> |
777 | 777 | </ul> |
778 | 778 | </div> |
779 | 779 | |
780 | | <h4><?php _e( 'Logged-Out', 'buddypress' ) ?></h4> |
781 | | <p><?php _e( '<em>Logged-Out</em> links are not visible to users who are logged in.', 'buddypress' ) ?></p> |
| 780 | <h4><?php _e( 'Logged-Out', 'buddypress' ); ?></h4> |
| 781 | <p><?php _e( '<em>Logged-Out</em> links are not visible to users who are logged in.', 'buddypress' ); ?></p> |
782 | 782 | |
783 | 783 | <div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-loggedout" class="tabs-panel tabs-panel-active"> |
784 | 784 | <ul id="buddypress-menu-checklist-loggedout" class="categorychecklist form-no-clear"> |
785 | | <?php echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $tabs['loggedout']['pages'] ), 0, (object) $args );?> |
| 785 | <?php echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $tabs['loggedout']['pages'] ), 0, (object) $args ); ?> |
786 | 786 | </ul> |
787 | 787 | </div> |
788 | 788 | |
… |
… |
function bp_admin_do_wp_nav_menu_meta_box() { |
799 | 799 | |
800 | 800 | <p class="button-controls"> |
801 | 801 | <span class="list-controls"> |
802 | | <a href="<?php |
803 | | echo esc_url( add_query_arg( |
804 | | array( |
805 | | $post_type_name . '-tab' => 'all', |
806 | | 'selectall' => 1, |
807 | | ), |
808 | | remove_query_arg( $removed_args ) |
809 | | ) ); |
810 | | ?>#buddypress-menu" class="select-all"><?php _e( 'Select All', 'buddypress' ); ?></a> |
| 802 | <a href=" |
| 803 | <?php |
| 804 | echo esc_url( |
| 805 | add_query_arg( |
| 806 | array( |
| 807 | $post_type_name . '-tab' => 'all', |
| 808 | 'selectall' => 1, |
| 809 | ), |
| 810 | remove_query_arg( $removed_args ) |
| 811 | ) |
| 812 | ); |
| 813 | ?> |
| 814 | #buddypress-menu" class="select-all"><?php _e( 'Select All', 'buddypress' ); ?></a> |
811 | 815 | </span> |
812 | 816 | <span class="add-to-menu"> |
813 | | <input type="submit"<?php if ( function_exists( 'wp_nav_menu_disabled_check' ) ) : wp_nav_menu_disabled_check( $nav_menu_selected_id ); endif; ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( 'Add to Menu', 'buddypress' ); ?>" name="add-custom-menu-item" id="submit-buddypress-menu" /> |
| 817 | <input type="submit" |
| 818 | <?php |
| 819 | if ( function_exists( 'wp_nav_menu_disabled_check' ) ) : |
| 820 | wp_nav_menu_disabled_check( $nav_menu_selected_id ); |
| 821 | endif; |
| 822 | ?> |
| 823 | class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( 'Add to Menu', 'buddypress' ); ?>" name="add-custom-menu-item" id="submit-buddypress-menu" /> |
814 | 824 | <span class="spinner"></span> |
815 | 825 | </span> |
816 | 826 | </p> |
… |
… |
add_action( 'admin_head-post.php', 'bp_admin_email_add_codex_notice' ); |
891 | 901 | */ |
892 | 902 | function bp_email_tax_type_metabox( $post, $box ) { |
893 | 903 | $r = array( |
894 | | 'taxonomy' => bp_get_email_tax_type() |
| 904 | 'taxonomy' => bp_get_email_tax_type(), |
895 | 905 | ); |
896 | 906 | |
897 | 907 | $tax_name = esc_attr( $r['taxonomy'] ); |
… |
… |
function bp_email_tax_type_metabox( $post, $box ) { |
904 | 914 | echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. |
905 | 915 | ?> |
906 | 916 | <ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear"> |
907 | | <?php wp_terms_checklist( $post->ID, array( 'taxonomy' => $tax_name, 'walker' => new BP_Walker_Category_Checklist ) ); ?> |
| 917 | <?php |
| 918 | wp_terms_checklist( |
| 919 | $post->ID, |
| 920 | array( |
| 921 | 'taxonomy' => $tax_name, |
| 922 | 'walker' => new BP_Walker_Category_Checklist(), |
| 923 | ) |
| 924 | ); |
| 925 | ?> |
908 | 926 | </ul> |
909 | 927 | </div> |
910 | 928 | |
… |
… |
add_action( 'add_meta_boxes_' . bp_get_email_post_type(), 'bp_email_custom_metab |
935 | 953 | * @param WP_Post $post |
936 | 954 | */ |
937 | 955 | function bp_email_plaintext_metabox( $post ) { |
938 | | ?> |
| 956 | ?> |
939 | 957 | |
940 | | <label class="screen-reader-text" for="excerpt"><?php |
| 958 | <label class="screen-reader-text" for="excerpt"> |
| 959 | <?php |
941 | 960 | /* translators: accessibility text */ |
942 | 961 | _e( 'Plain text email content', 'buddypress' ); |
943 | | ?></label><textarea rows="5" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; // textarea_escaped ?></textarea> |
| 962 | ?> |
| 963 | </label><textarea rows="5" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; // textarea_escaped ?></textarea> |
944 | 964 | |
945 | 965 | <p><?php _e( 'Most email clients support HTML email. However, some people prefer to receive plain text email. Enter a plain text alternative version of your email here.', 'buddypress' ); ?></p> |
946 | 966 | |
947 | | <?php |
| 967 | <?php |
948 | 968 | } |
949 | 969 | |
950 | 970 | /** |
… |
… |
function bp_email_plaintext_metabox( $post ) { |
964 | 984 | * @since 1.9.0 |
965 | 985 | */ |
966 | 986 | function bp_admin_wp_nav_menu_restrict_items() { |
967 | | ?> |
| 987 | ?> |
968 | 988 | <script type="text/javascript"> |
969 | 989 | jQuery( '#menu-to-edit').on( 'click', 'a.item-edit', function() { |
970 | 990 | var settings = jQuery(this).closest( '.menu-item-bar' ).next( '.menu-item-settings' ); |
… |
… |
function bp_admin_wp_nav_menu_restrict_items() { |
976 | 996 | } |
977 | 997 | }); |
978 | 998 | </script> |
979 | | <?php |
| 999 | <?php |
980 | 1000 | } |
981 | 1001 | |
982 | 1002 | /** |
… |
… |
function bp_core_admin_user_row_actions( $actions, $user_object ) { |
992 | 1012 | |
993 | 1013 | // Setup the $user_id variable from the current user object. |
994 | 1014 | $user_id = 0; |
995 | | if ( !empty( $user_object->ID ) ) { |
| 1015 | if ( ! empty( $user_object->ID ) ) { |
996 | 1016 | $user_id = absint( $user_object->ID ); |
997 | 1017 | } |
998 | 1018 | |
… |
… |
function bp_core_admin_user_row_actions( $actions, $user_object ) { |
1004 | 1024 | |
1005 | 1025 | // If spammed, create unspam link. |
1006 | 1026 | if ( bp_is_user_spammer( $user_id ) ) { |
1007 | | $url = add_query_arg( array( 'action' => 'ham', 'user' => $user_id ), $url ); |
1008 | | $unspam_link = wp_nonce_url( $url, 'bp-spam-user' ); |
1009 | | $actions['ham'] = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $unspam_link ), esc_html__( 'Not Spam', 'buddypress' ) ); |
| 1027 | $url = add_query_arg( |
| 1028 | array( |
| 1029 | 'action' => 'ham', |
| 1030 | 'user' => $user_id, |
| 1031 | ), |
| 1032 | $url |
| 1033 | ); |
| 1034 | $unspam_link = wp_nonce_url( $url, 'bp-spam-user' ); |
| 1035 | $actions['ham'] = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $unspam_link ), esc_html__( 'Not Spam', 'buddypress' ) ); |
1010 | 1036 | |
1011 | | // If not already spammed, create spam link. |
| 1037 | // If not already spammed, create spam link. |
1012 | 1038 | } else { |
1013 | | $url = add_query_arg( array( 'action' => 'spam', 'user' => $user_id ), $url ); |
| 1039 | $url = add_query_arg( |
| 1040 | array( |
| 1041 | 'action' => 'spam', |
| 1042 | 'user' => $user_id, |
| 1043 | ), |
| 1044 | $url |
| 1045 | ); |
1014 | 1046 | $spam_link = wp_nonce_url( $url, 'bp-spam-user' ); |
1015 | 1047 | $actions['spam'] = sprintf( '<a class="submitdelete" href="%1$s">%2$s</a>', esc_url( $spam_link ), esc_html__( 'Spam', 'buddypress' ) ); |
1016 | 1048 | } |
… |
… |
add_filter( 'admin_body_class', 'bp_core_admin_body_classes' ); |
1141 | 1173 | * |
1142 | 1174 | * @since 5.0.0 |
1143 | 1175 | * |
1144 | | * @param array $categories Array of block categories. |
1145 | | * @param object $post Post being loaded. |
| 1176 | * @param array $categories Array of block categories. |
| 1177 | * @param object $post Post being loaded. |
1146 | 1178 | */ |
1147 | 1179 | function bp_block_category( $categories = array(), $post = null ) { |
1148 | 1180 | if ( ! ( $post instanceof WP_Post ) ) { |
… |
… |
function bp_block_category( $categories = array(), $post = null ) { |
1169 | 1201 | return $categories; |
1170 | 1202 | } |
1171 | 1203 | |
1172 | | return array_merge( $categories, array( |
| 1204 | return array_merge( |
| 1205 | $categories, |
1173 | 1206 | array( |
1174 | | 'slug' => 'buddypress', |
1175 | | 'title' => __( 'BuddyPress', 'buddypress' ), |
1176 | | 'icon' => 'buddicons-buddypress-logo', |
1177 | | ), |
1178 | | ) ); |
| 1207 | array( |
| 1208 | 'slug' => 'buddypress', |
| 1209 | 'title' => __( 'BuddyPress', 'buddypress' ), |
| 1210 | 'icon' => 'buddicons-buddypress-logo', |
| 1211 | ), |
| 1212 | ) |
| 1213 | ); |
1179 | 1214 | } |
1180 | 1215 | add_filter( 'block_categories', 'bp_block_category', 1, 2 ); |