bbdev

Buddypress -Add new link in user profile menu (bp_setup_nav)

May 11th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.50 KB | None | 0 0
  1. <?php
  2. add_action( 'bp_setup_nav', 'bboss_add_bpnav' );
  3. function bboss_add_bpnav(){
  4.     $bp = buddypress();
  5.    
  6.     bp_core_new_nav_item( array(
  7.         'name' => __( 'About', 'TEXTDOMAIN' ),
  8.         'slug' => 'about',
  9.         'parent_url' => $bp->loggedin_user->domain . $bp->slug . '/',
  10.         'parent_slug' => $bp->slug,
  11.         'screen_function'   => 'bboss_bpnav_screen',
  12.         'position' => 40 ,
  13.         'default_subnav_slug' => 'about-me',
  14.     ) );
  15.    
  16.     bp_core_new_subnav_item( array(
  17.         'name' => __( 'About Me', 'TEXTDOMAIN' ),
  18.         'slug' => 'about-me',
  19.         'parent_url' => $bp->loggedin_user->domain . $bp->slug . '/' . 'about/',
  20.         'parent_slug' => 'citations',
  21.         'screen_function'   => 'bboss_bpnav_screen',
  22.         'position' => 11,
  23.         'item_css_id' => 'about-me',
  24.     ) );
  25. }
  26.  
  27. function bboss_bpnav_screen(){
  28.     add_action( 'bp_template_title', 'bboss_bpnav_screen_title' );
  29.     add_action( 'bp_template_content', 'bboss_bpnav_screen_content' );
  30.     bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
  31. }
  32.  
  33. function bboss_bpnav_screen_title(){
  34.     _e( 'About', 'TEXTDOMAIN' );
  35. }
  36.  
  37. function bboss_bpnav_screen_content(){
  38.     //screen content
  39.     echo "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent placerat ac justo eget euismod. Curabitur a pretium sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vulputate finibus metus, ac dapibus massa venenatis a. Sed pretium fringilla quam, quis sollicitudin sapien tincidunt nec.</p>";
  40. }
Add Comment
Please, Sign In to add comment