Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/19/2018 04:43:56 PM (8 years ago)
Author:
djpaul
Message:

Templates, Nouveau: remove unused bp_nouveau_get_forsaken_hooks().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/includes/functions.php

    r11900 r11902  
    364364function bp_nouveau_current_user_can( $capability = '' ) {
    365365    return apply_filters( 'bp_nouveau_current_user_can', is_user_logged_in(), $capability, bp_loggedin_user_id() );
    366 }
    367 
    368 /**
    369  * BP Nouveau will not use this hooks anymore
    370  *
    371  * @since 3.0.0
    372  *
    373  * @return array the list of disused legacy hooks
    374  */
    375 function bp_nouveau_get_forsaken_hooks() {
    376     $forsaken_hooks = array(
    377         'bp_members_directory_member_types' => array(
    378             'hook_type'    => 'action',
    379             'message_type' => 'warning',
    380             'message'      => 'the \'bp_members_directory_member_types\' action will soon be deprecated in the BP Nouveau template pack, use the \'bp_nouveau_get_members_directory_nav_items\' filter instead',
    381         ),
    382         'bp_before_activity_type_tab_all' => array(
    383             'hook_type'    => 'action',
    384             'message_type' => 'warning',
    385             'message'      => 'the \'bp_before_activity_type_tab_all\' action will soon be deprecated in the BP Nouveau template pack, use the \'bp_nouveau_get_activity_directory_nav_items\' filter instead',
    386         ),
    387         'bp_before_activity_type_tab_friends' => array(
    388             'hook_type'    => 'action',
    389             'message_type' => 'warning',
    390             'message'      => 'the \'bp_before_activity_type_tab_friends\' action will soon be deprecated in the BP Nouveau template pack, use the \'bp_nouveau_get_activity_directory_nav_items\' filter instead',
    391         ),
    392         'bp_before_activity_type_tab_groups' => array(
    393             'hook_type'    => 'action',
    394             'message_type' => 'warning',
    395             'message'      => 'the \'bp_before_activity_type_tab_groups\' action will soon be deprecated in the BP Nouveau template pack, use the \'bp_nouveau_get_activity_directory_nav_items\' filter instead',
    396         ),
    397         'bp_before_activity_type_tab_favorites' => array(
    398             'hook_type'    => 'action',
    399             'message_type' => 'warning',
    400             'message'      => 'the \'bp_before_activity_type_tab_favorites\' action will soon be deprecated in the BP Nouveau template pack, use the \'bp_nouveau_get_activity_directory_nav_items\' filter instead',
    401         ),
    402         'bp_before_activity_type_tab_mentions' => array(
    403             'hook_type'    => 'action',
    404             'message_type' => 'warning',
    405             'message'      => 'the \'bp_before_activity_type_tab_mentions\' action will soon be deprecated in the BP Nouveau template pack, use the \'bp_nouveau_get_activity_directory_nav_items\' filter instead',
    406         ),
    407         'bp_activity_type_tabs' => array(
    408             'hook_type'    => 'action',
    409             'message_type' => 'warning',
    410             'message'      => 'the \'bp_activity_type_tabs\' action will soon be deprecated in the BP Nouveau template pack, use the \'bp_nouveau_get_activity_directory_nav_items\' filter instead',
    411         ),
    412         'bp_groups_directory_group_filter' => array(
    413             'hook_type'    => 'action',
    414             'message_type' => 'warning',
    415             'message'      => 'the \'bp_groups_directory_group_filter\' action will soon be deprecated in the BP Nouveau template pack, use the \'bp_nouveau_get_activity_directory_nav_items\' filter instead',
    416         ),
    417         'bp_blogs_directory_blog_types' => array(
    418             'hook_type'    => 'action',
    419             'message_type' => 'warning',
    420             'message'      => 'the \'bp_blogs_directory_blog_types\' action will soon be deprecated in the BP Nouveau template pack, use the \'bp_nouveau_get_activity_directory_nav_items\' filter instead',
    421         ),
    422         'bp_members_directory_order_options' => array(
    423             'hook_type'    => 'action',
    424             'message_type' => 'warning',
    425             'message'      => 'The \'bp_members_directory_order_options\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_members_filters\' filter instead',
    426         ),
    427         'bp_groups_members_order_options' => array(
    428             'hook_type'    => 'action',
    429             'message_type' => 'warning',
    430             'message'      => 'The \'bp_groups_members_order_options\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_members_filters\' filter instead',
    431         ),
    432         'bp_member_friends_order_options' => array(
    433             'hook_type'    => 'action',
    434             'message_type' => 'warning',
    435             'message'      => 'The \'bp_member_friends_order_options\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_members_filters\' filter instead',
    436         ),
    437         'bp_activity_filter_options' => array(
    438             'hook_type'    => 'action',
    439             'message_type' => 'warning',
    440             'message'      => 'Instead of using the \'bp_activity_filter_options\' action you should register your activity types using the function \'bp_activity_set_action\'',
    441         ),
    442         'bp_member_activity_filter_options' => array(
    443             'hook_type'    => 'action',
    444             'message_type' => 'warning',
    445             'message'      => 'Instead of using the \'bp_member_activity_filter_options\' action you should register your activity types using the function \'bp_activity_set_action\'',
    446         ),
    447         'bp_group_activity_filter_options' => array(
    448             'hook_type'    => 'action',
    449             'message_type' => 'warning',
    450             'message'      => 'Instead of using the \'bp_group_activity_filter_options\' action you should register your activity types using the function \'bp_activity_set_action\'',
    451         ),
    452         'bp_groups_directory_order_options' => array(
    453             'hook_type'    => 'action',
    454             'message_type' => 'warning',
    455             'message'      => 'The \'bp_groups_directory_order_options\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_groups_filters\' filter instead',
    456         ),
    457         'bp_member_group_order_options' => array(
    458             'hook_type'    => 'action',
    459             'message_type' => 'warning',
    460             'message'      => 'The \'bp_member_group_order_options\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_groups_filters\' filter instead',
    461         ),
    462         'bp_member_blog_order_options' => array(
    463             'hook_type'    => 'action',
    464             'message_type' => 'warning',
    465             'message'      => 'The \'bp_member_blog_order_options\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_blogs_filters\' filter instead',
    466         ),
    467         'bp_blogs_directory_order_options' => array(
    468             'hook_type'    => 'action',
    469             'message_type' => 'warning',
    470             'message'      => 'The \'bp_blogs_directory_order_options\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_blogs_filters\' filter instead',
    471         ),
    472         'bp_activity_entry_meta' => array(
    473             'hook_type'    => 'action',
    474             'message_type' => 'warning',
    475             'message'      => 'The \'bp_activity_entry_meta\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_activity_entry_buttons\' filter instead',
    476         ),
    477         'bp_member_header_actions' => array(
    478             'hook_type'    => 'action',
    479             'message_type' => 'warning',
    480             'message'      => 'The \'bp_member_header_actions\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_members_buttons\' filter instead',
    481         ),
    482         'bp_directory_members_actions' => array(
    483             'hook_type'    => 'action',
    484             'message_type' => 'warning',
    485             'message'      => 'The \'bp_directory_members_actions\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_members_buttons\' filter instead',
    486         ),
    487         'bp_group_members_list_item_action' => array(
    488             'hook_type'    => 'action',
    489             'message_type' => 'warning',
    490             'message'      => 'The \'bp_group_members_list_item_action\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_members_buttons\' filter instead',
    491         ),
    492         'bp_friend_requests_item_action' => array(
    493             'hook_type'    => 'action',
    494             'message_type' => 'warning',
    495             'message'      => 'The \'bp_friend_requests_item_action\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_members_buttons\' filter instead',
    496         ),
    497         'bp_group_header_meta' => array(
    498             'hook_type'    => 'action',
    499             'message_type' => 'warning',
    500             'message'      => 'The \'bp_group_header_meta\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_group_meta\' filter instead',
    501         ),
    502         'bp_directory_members_item' => array(
    503             'hook_type'    => 'action',
    504             'message_type' => 'warning',
    505             'message'      => 'The \'bp_directory_members_item\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_member_meta\' filter instead',
    506         ),
    507         'bp_profile_header_meta' => array(
    508             'hook_type'    => 'action',
    509             'message_type' => 'warning',
    510             'message'      => 'The \'bp_profile_header_meta\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_member_meta\' filter instead',
    511         ),
    512         'bp_group_header_actions' => array(
    513             'hook_type'    => 'action',
    514             'message_type' => 'warning',
    515             'message'      => 'The \'bp_group_header_actions\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_groups_buttons\' filter instead',
    516         ),
    517         'bp_directory_groups_actions' => array(
    518             'hook_type'    => 'action',
    519             'message_type' => 'warning',
    520             'message'      => 'The \'bp_directory_groups_actions\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_groups_buttons\' filter instead',
    521         ),
    522         'create-invite-friends' => array(
    523             'type'    => 'info',
    524             'message' => __( 'You can send invites to any of your friends listed here, or skip this step & send later from the group. Invites sent from this screen will appear in the groups \'Pending Invites\' tab of the \'Send Invites\' menu.', 'buddypress' ),
    525         ),
    526         'bp_group_invites_item_action' => array(
    527             'hook_type'    => 'action',
    528             'message_type' => 'warning',
    529             'message'      => 'The \'bp_group_invites_item_action\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_groups_buttons\' filter instead',
    530         ),
    531         'bp_group_membership_requests_admin_item_action' => array(
    532             'hook_type'    => 'action',
    533             'message_type' => 'warning',
    534             'message'      => 'The \'bp_group_membership_requests_admin_item_action\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_groups_buttons\' filter instead',
    535         ),
    536         'bp_group_manage_members_admin_item' => array(
    537             'hook_type'    => 'action',
    538             'message_type' => 'warning',
    539             'message'      => 'The \'bp_group_manage_members_admin_item\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_groups_buttons\' filter instead',
    540         ),
    541         'bp_directory_blogs_actions' => array(
    542             'hook_type'    => 'action',
    543             'message_type' => 'warning',
    544             'message'      => 'The \'bp_directory_blogs_actions\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_blogs_buttons\' filter instead',
    545         ),
    546         'bp_activity_comment_options' => array(
    547             'hook_type'    => 'action',
    548             'message_type' => 'warning',
    549             'message'      => 'The \'bp_activity_comment_options\' action will soon be deprecated in the BP Nouveau template pack, we recommend you now use the \'bp_nouveau_get_activity_comment_buttons\' filter instead',
    550         ),
    551         'groups_custom_group_fields_editable' => array(
    552             'hook_type'    => 'action',
    553             'message_type' => 'error',
    554             'message'      => 'The \'groups_custom_group_fields_editable\' action is deprecated in the BP Nouveau template pack, please use \'bp_after_group_details_creation_step\' or \'bp_after_group_details_admin\' instead',
    555         ),
    556     );
    557 
    558     /*
    559      * Add warning messages for people using dynamic filters the BP Nouveau Nav Loop
    560      * won't take in account unlike bp_get_displayed_user_nav() & bp_get_options_nav().
    561      */
    562     $nav_items = array();
    563     if ( bp_is_user() ) {
    564         $nav_items = buddypress()->members->nav->get_item_nav();
    565     } elseif ( bp_is_group() && ! bp_is_group_create() ) {
    566         $nav_items = buddypress()->groups->nav->get_secondary( array( 'parent_slug' => bp_get_current_group_slug() ), false );
    567     }
    568 
    569     if ( $nav_items ) {
    570         // Set the common parts
    571         $common = array(
    572             'hook_type'    => 'filter',
    573             'message_type' => 'error',
    574         );
    575 
    576         // And the warning message
    577         $message = __( 'The \'%s\' filter is not used in the BP Nouveau template pack, please use one of the filters of the BP Nouveau Navigation Loop instead', 'buddypress' );
    578 
    579         foreach ( $nav_items as $nav_item ) {
    580             if ( ! isset( $nav_item->children ) ) {
    581                 $filter = 'bp_get_options_nav_' . $nav_item->css_id;
    582                 $forsaken_hooks[ $filter ] = array_merge( $common, array(
    583                     'message' => sprintf( $message, $filter ),
    584                 ) );
    585             } else {
    586                 $filter = 'bp_get_displayed_user_nav_' . $nav_item->css_id;
    587                 $forsaken_hooks[ $filter ] = array_merge( $common, array(
    588                     'message' => sprintf( $message, $filter ),
    589                 ) );
    590 
    591                 foreach ( $nav_item->children as $child ) {
    592                     $filter = 'bp_get_options_nav_' . $child->css_id;
    593                     $forsaken_hooks[ $filter ] = array_merge( $common, array(
    594                         'message' => sprintf( $message, $filter ),
    595                     ) );
    596                 }
    597             }
    598         }
    599     }
    600 
    601     return $forsaken_hooks;
    602366}
    603367
Note: See TracChangeset for help on using the changeset viewer.