diff --git a/bp-templates/bp-nouveau/buddypress-functions.php b/bp-templates/bp-nouveau/buddypress-functions.php index 73f31b2..6994c35 100644 --- a/bp-templates/bp-nouveau/buddypress-functions.php +++ b/bp-templates/bp-nouveau/buddypress-functions.php @@ -112,6 +112,11 @@ private function includes() { require $this->includes_dir . 'classes.php'; require $this->includes_dir . 'template-tags.php'; + // Load debug code only if debug mode is on. + if ( true === WP_DEBUG ) { + require $this->includes_dir . 'debug.php'; + } + // Test suite requires the AJAX functions early. if ( function_exists( 'tests_add_filter' ) ) { require $this->includes_dir . 'ajax.php'; @@ -487,9 +492,6 @@ public function localize_scripts() { $params['objects'] = $supported_objects; $params['nonces'] = $object_nonces; - // Add Warnings if any - $params['warnings'] = $this->developer_feedbacks(); - // Used to transport the settings inside the Ajax requests if ( is_customize_preview() ) { $params['customizer_settings'] = bp_nouveau_get_temporary_setting( 'any' ); @@ -632,46 +634,6 @@ public function setup_directory_nav() { } } - /** - * Inform developers about the Legacy hooks - * we are not using. This will be output as - * warnings inside the Browser console to avoid - * messing with the page display. - * - * @since 1.0.0 - * - * @return string HTML Output - */ - public function developer_feedbacks() { - $notices = array(); - - // If debug is not on, stop! - if ( ! WP_DEBUG ) { - return; - } - - // Get The forsaken hooks. - $forsaken_hooks = bp_nouveau_get_forsaken_hooks(); - - // Loop to check if deprecated hooks are used. - foreach ( $forsaken_hooks as $hook => $feedback ) { - if ( 'action' === $feedback['hook_type'] ) { - if ( ! has_action( $hook ) ) { - continue; - } - - } elseif ( 'filter' === $feedback['hook_type'] ) { - if ( ! has_filter( $hook ) ) { - continue; - } - } - - $notices[] = $feedback['message']; - } - - return $notices; - } - /** * We'll handle template notices from BP Nouveau. * diff --git a/bp-templates/bp-nouveau/includes/debug.php b/bp-templates/bp-nouveau/includes/debug.php new file mode 100644 index 0000000..20a23f4 --- /dev/null +++ b/bp-templates/bp-nouveau/includes/debug.php @@ -0,0 +1,278 @@ + array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_before_activity_type_tab_all' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_before_activity_type_tab_friends' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_before_activity_type_tab_groups' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_before_activity_type_tab_favorites' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_before_activity_type_tab_mentions' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_activity_type_tabs' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_groups_directory_group_filter' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_blogs_directory_blog_types' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_members_directory_order_options' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_groups_members_order_options' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_member_friends_order_options' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_activity_filter_options' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + 'message' => __( 'Instead of using the \'bp_activity_filter_options\' action you should register your activity types using the function \'bp_activity_set_action\'', 'bp-nouveau' ), + ), + 'bp_member_activity_filter_options' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + 'message' => __( 'Instead of using the \'bp_member_activity_filter_options\' action you should register your activity types using the function \'bp_activity_set_action\'', 'bp-nouveau' ), + ), + 'bp_group_activity_filter_options' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + 'message' => __( 'Instead of using the \'bp_group_activity_filter_options\' action you should register your activity types using the function \'bp_activity_set_action\'', 'bp-nouveau' ), + ), + 'bp_groups_directory_order_options' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_member_group_order_options' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_member_blog_order_options' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_blogs_directory_order_options' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_activity_entry_meta' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_member_header_actions' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_directory_members_actions' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_group_members_list_item_action' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_friend_requests_item_action' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_group_header_meta' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_directory_members_item' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_profile_header_meta' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_group_header_actions' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_directory_groups_actions' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_group_invites_item_action' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_group_membership_requests_admin_item_action' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_group_manage_members_admin_item' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_directory_blogs_actions' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'bp_activity_comment_options' => array( + 'hook_type' => 'action', + 'message_type' => 'warning', + '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', 'bp-nouveau' ), + ), + 'groups_custom_group_fields_editable' => array( + 'hook_type' => 'action', + 'message_type' => 'error', + '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', 'bp-nouveau' ), + ), + ); + + /** + * Add warning messages for people using dynamic filters the BP Nouveau Nav Loop + * won't take in account unlike bp_get_displayed_user_nav() & bp_get_options_nav(). + */ + $nav_items = array(); + if ( bp_is_user() ) { + $nav_items = buddypress()->members->nav->get_item_nav(); + } elseif ( bp_is_group() && ! bp_is_group_create() ) { + $nav_items = buddypress()->groups->nav->get_secondary( array( 'parent_slug' => bp_get_current_group_slug() ), false ); + } + + if ( $nav_items ) { + + // Set the common parts + $common = array( + 'hook_type' => 'filter', + 'message_type' => 'error', + ); + + // And the warning message + $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', 'bp-nouveau' ); + + foreach ( $nav_items as $nav_item ) { + if ( ! isset( $nav_item->children ) ) { + $filter = 'bp_get_options_nav_' . $nav_item->css_id; + $forsaken_hooks[ $filter ] = array_merge( $common, array( + 'message' => sprintf( $message, $filter ), + ) ); + } else { + $filter = 'bp_get_displayed_user_nav_' . $nav_item->css_id; + $forsaken_hooks[ $filter ] = array_merge( $common, array( + 'message' => sprintf( $message, $filter ), + ) ); + + foreach ( $nav_item->children as $child ) { + $filter = 'bp_get_options_nav_' . $child->css_id; + $forsaken_hooks[ $filter ] = array_merge( $common, array( + 'message' => sprintf( $message, $filter ), + ) ); + } + } + } + } + + return $forsaken_hooks; +} + +/** + * Inform developers about the Legacy hooks we are not using. + * + * This will be output as warnings inside the Browser console to avoid + * messing with the page display. + * + * @since 1.0.0 + * + * @param array $retval Current JS properties. + * @return array + */ +add_filter( 'bp_core_get_js_strings', function( $retval ) { + // Get The forsaken hooks. + $forsaken_hooks = bp_nouveau_get_forsaken_hooks(); + + $notices = array(); + + // Loop to check if deprecated hooks are used. + foreach ( $forsaken_hooks as $hook => $feedback ) { + if ( 'action' === $feedback['hook_type'] ) { + if ( ! has_action( $hook ) ) { + continue; + } + + } elseif ( 'filter' === $feedback['hook_type'] ) { + if ( ! has_filter( $hook ) ) { + continue; + } + } + + $notices[] = $feedback['message']; + } + + $retval['warnings'] = $notices; + return $retval; +} ); \ No newline at end of file diff --git a/bp-templates/bp-nouveau/includes/functions.php b/bp-templates/bp-nouveau/includes/functions.php index d078f9f..d88c265 100644 --- a/bp-templates/bp-nouveau/includes/functions.php +++ b/bp-templates/bp-nouveau/includes/functions.php @@ -355,239 +355,6 @@ function bp_nouveau_current_user_can( $capability = '' ) { return apply_filters( 'bp_nouveau_current_user_can', is_user_logged_in(), $capability, bp_loggedin_user_id() ); } -/** - * BP Nouveau will not use this hooks anymore - * - * @since 1.0.0 - * - * @return array the list of disused legacy hooks - */ -function bp_nouveau_get_forsaken_hooks() { - $forsaken_hooks = array( - 'bp_members_directory_member_types' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_before_activity_type_tab_all' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_before_activity_type_tab_friends' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_before_activity_type_tab_groups' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_before_activity_type_tab_favorites' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_before_activity_type_tab_mentions' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_activity_type_tabs' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_groups_directory_group_filter' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_blogs_directory_blog_types' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_members_directory_order_options' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_groups_members_order_options' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_member_friends_order_options' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_activity_filter_options' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - 'message' => __( 'Instead of using the \'bp_activity_filter_options\' action you should register your activity types using the function \'bp_activity_set_action\'', 'bp-nouveau' ), - ), - 'bp_member_activity_filter_options' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - 'message' => __( 'Instead of using the \'bp_member_activity_filter_options\' action you should register your activity types using the function \'bp_activity_set_action\'', 'bp-nouveau' ), - ), - 'bp_group_activity_filter_options' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - 'message' => __( 'Instead of using the \'bp_group_activity_filter_options\' action you should register your activity types using the function \'bp_activity_set_action\'', 'bp-nouveau' ), - ), - 'bp_groups_directory_order_options' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_member_group_order_options' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_member_blog_order_options' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_blogs_directory_order_options' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_activity_entry_meta' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_member_header_actions' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_directory_members_actions' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_group_members_list_item_action' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_friend_requests_item_action' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_group_header_meta' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_directory_members_item' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_profile_header_meta' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_group_header_actions' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_directory_groups_actions' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_group_invites_item_action' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_group_membership_requests_admin_item_action' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_group_manage_members_admin_item' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_directory_blogs_actions' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'bp_activity_comment_options' => array( - 'hook_type' => 'action', - 'message_type' => 'warning', - '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', 'bp-nouveau' ), - ), - 'groups_custom_group_fields_editable' => array( - 'hook_type' => 'action', - 'message_type' => 'error', - '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', 'bp-nouveau' ), - ), - ); - - /** - * Add warning messages for people using dynamic filters the BP Nouveau Nav Loop - * won't take in account unlike bp_get_displayed_user_nav() & bp_get_options_nav(). - */ - $nav_items = array(); - if ( bp_is_user() ) { - $nav_items = buddypress()->members->nav->get_item_nav(); - } elseif ( bp_is_group() && ! bp_is_group_create() ) { - $nav_items = buddypress()->groups->nav->get_secondary( array( 'parent_slug' => bp_get_current_group_slug() ), false ); - } - - if ( $nav_items ) { - - // Set the common parts - $common = array( - 'hook_type' => 'filter', - 'message_type' => 'error', - ); - - // And the warning message - $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', 'bp-nouveau' ); - - foreach ( $nav_items as $nav_item ) { - if ( ! isset( $nav_item->children ) ) { - $filter = 'bp_get_options_nav_' . $nav_item->css_id; - $forsaken_hooks[ $filter ] = array_merge( $common, array( - 'message' => sprintf( $message, $filter ), - ) ); - } else { - $filter = 'bp_get_displayed_user_nav_' . $nav_item->css_id; - $forsaken_hooks[ $filter ] = array_merge( $common, array( - 'message' => sprintf( $message, $filter ), - ) ); - - foreach ( $nav_item->children as $child ) { - $filter = 'bp_get_options_nav_' . $child->css_id; - $forsaken_hooks[ $filter ] = array_merge( $common, array( - 'message' => sprintf( $message, $filter ), - ) ); - } - } - } - } - - return $forsaken_hooks; -} - /** * Parse an html output to a list of component's directory nav item. *