Skip to:
Content
Pages
Categories
Search
Top
Bottom

Get the user nav in a separate page


  • nabilyazghi
    Participant

    @nabilyazghi

    Hi,
    I am writing some code related with buddypress profile page,and I want to display the user_nav_in in a separate page,the function bp_get_displayed_user_nav gives an error Invalid argument supplied for foreach() because the array $bp->members->nav->get_primary() does not have any values ,because the display_user->id is empty,
    I tried to set up it with $bp->displayed_user->id=”ExampleId” but with no success,
    Does any one have an idea?
    Thank you,
    Sincerely.
    Nabil

Viewing 7 replies - 1 through 7 (of 7 total)

  • danbp
    Participant

    @danbp

    Hi @nabilyazghi,

    You could perhaps use something like this:

    function blabla() {
         if ( ! bp_is_my_profile() ) 
    	$nav_array = 'what_you_need';
    
         return $nav_array;
    }
    add_filter('bp_get_displayed_user_nav', 'blabla', 10, 1 );

    Function ref: http://hookr.io/plugins/buddypress/2.4.3/functions/bp_get_displayed_user_nav/


    nabilyazghi
    Participant

    @nabilyazghi

    Hi,Thank you for your replu danbp,that is a good one,however I need exaclty the content of $nav_array even if the user is not logged in and he is not in the profile page of a user,
    as an example,I want to include the nav bar in another page but I can not do it because no datas are returned


    danbp
    Participant

    @danbp

    I’m wondering why you don’t use WP Menu to do that !

    Dashboard > Apparance > Menu > add new menu and select from BP options.

    If not visible, activate BuddyPress in screen options (top right corner).
    Within the appearing BP options (left column) select the items you need for the new menu. Then activate that menu on your custom page.

    This menu is always contextual and is showed to everyone, whatever his status.


    nabilyazghi
    Participant

    @nabilyazghi

    Hi,
    I didn’t get what did you meant,but for me my aim is to include the profile page of specific user in another separate page(I searched in the net but all plugins do not do the task which I want) I did some coding(trying to set the displayed_user_id var) and I get all informations about the user,however I can’t get the nav_bar items of it,is there a solution which I can do?
    Regards,


    nabilyazghi
    Participant

    @nabilyazghi

    Up Up


    danbp
    Participant

    @danbp

    Basically, you’re trying to built a page menu. That’s WP territory

    See here an example using wp_page_menu function which may help to going further:
    https://buddypress.org/support/topic/notification-count-in-dynamic-menu/


    nabilyazghi
    Participant

    @nabilyazghi

    Hi,
    Thank you,I think I didn’t explain very well,I found a clue,and I’ll reply with my solution soon.
    Regards,
    Nabil

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Skip to toolbar