arie_cristianD

jnews restore bp profile classic nav

Jul 14th, 2026
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. /**
  2.  * Restore BuddyPress profile classic sub navigation after JNews Video overrides it.
  3.  */
  4. function jnews_restore_bp_profile_classic_nav() {
  5.     if ( ! function_exists( 'bp_core_remove_subnav_item' ) || ! function_exists( 'bp_core_new_subnav_item' ) || ! function_exists( 'bp_core_new_nav_default' ) ) {
  6.         return;
  7.     }
  8.  
  9.     $user_domain = bp_displayed_user_domain() ? bp_displayed_user_domain() : bp_loggedin_user_domain();
  10.  
  11.     if ( empty( $user_domain ) ) {
  12.         return;
  13.     }
  14.  
  15.     bp_core_remove_subnav_item( 'profile', 'home' );
  16.     bp_core_remove_subnav_item( 'profile', 'public' );
  17.  
  18.     bp_core_new_subnav_item(
  19.         array(
  20.             'name'            => _x( 'View', 'Member profile view', 'buddypress' ),
  21.             'slug'            => 'classic',
  22.             'parent_url'      => trailingslashit( $user_domain . 'profile' ),
  23.             'parent_slug'     => 'profile',
  24.             'screen_function' => 'bp_members_screen_display_profile',
  25.             'position'        => 2,
  26.             'item_css_id'     => 'classic',
  27.         )
  28.     );
  29.  
  30.     bp_core_new_nav_default(
  31.         array(
  32.             'parent_slug'     => 'profile',
  33.             'subnav_slug'     => 'classic',
  34.             'screen_function' => 'bp_members_screen_display_profile',
  35.         )
  36.     );
  37. }
  38. add_action( 'bp_setup_nav', 'jnews_restore_bp_profile_classic_nav', 999 );
Advertisement
Add Comment
Please, Sign In to add comment