fakrulislam (@fakrulislam)

Forum Replies Created

Viewing 1 replies (of 1 total)
  • @fakrulislam

    Participant

    Thanks Robin W, it worked!. The working code is below for others help.

    /**
    * Add bbp user profile link in WP nav menu
    * Filter wp_nav_menu() to add profile link
    */
    function prefix_bbp_profile_link_nav_menu($menu) {
    	
        if ( !is_user_logged_in() )
            return $menu;
        else   
            $current_user 				= 	wp_get_current_user();
            $user					=	$current_user->ID;
            $bbp_profile_url			=       bbp_get_user_profile_url( $user);
            $bbp_profile_menu_link	  	        = 	'<li>
    			        				<a href=" '. esc_url( $bbp_profile_url ) .' "> '. __('Edit Profile', 'text-domain' ) .' </a>
    							</li>';
            $menu         	= 	$menu . $bbp_profile_menu_link;
            
            return $menu;
      
    }
    add_filter( 'wp_nav_menu_items', 'prefix_bbp_profile_link_nav_menu' );
Viewing 1 replies (of 1 total)