Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding "My Profile" and "My Messages" to main menu

  • Avatar of faktanett
    faktanett
    Participant

    @faktanett

    Hi

    I want to add the links in topic title to my main menu. Now, I have figured out this is not entirely straightforward to do. (This puzzles me by the way, that it is not available out of the box)

    Anyways, I have found out thet `echo bp_loggedin_user_domain();` returns profile link, and `echo bp_loggedin_user_domain().’messages/’;` returns link to messages.

    My plan was to just create a couple files that use these snippets to redirect directly to the profile/messages page and link to these in menu, and quickly made profileredirect.php and just added the first snippet as a test, something that just ended up with a “Call to undefined function” error message.

    I guess the file needs more stuff to be “connected” to Buddypress, but have no idea what.

    Would anyone be willing to help me out with a short snippet of code I can cut&paste so the file when opened will just redirect to user profile?

Viewing 1 replies (of 1 total)
  • Avatar of faktanett
    faktanett
    Participant

    @faktanett

    Figured it out.

    Added to new files: profileredirect.php and messageredirect.php

    Code for profileredirect.php

    ` require(‘wp-blog-header.php’);
    header( ‘Location:’ . bp_loggedin_user_domain() . ” ) ;`

    Code for messageredirect.php

    ` require(‘wp-blog-header.php’);
    header( ‘Location:’ . bp_loggedin_user_domain().’messages/’ . ” ) ;`

    Then also installed https://wordpress.org/extend/plugins/nav-menu-roles/ and assigned the menu items to only be visible to logged in users (it will loop indefinately and time out if a logged out user tries to use them)

    Just in case someone else wants to do this.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.