Hi, This is regarding buddypress adding new tab to the member profile main nav and when is click direct user to the author posts www.mysite.com/Author/username/

After researching and looking I have find this code that it kinder works, it creates a new custom tab and direct users to the new post but the URL is not what i'm looking for it creates member/username/mypost what I need is something like this www.mysite.com/Author/username/ I just don't understand how i can achieve this with this code below....

function ibenic_buddypress_tab() { global $bp; bp_core_new_nav_item( array( 'name' => __( 'My Posts', 'ibenic' ), 'slug' => 'my-posts', 'position' => 100, 'screen_function' => 'ibenic_budypress_my_posts', 'show_for_displayed_user' => true, 'item_css_id' => 'ibenic_budypress_my_posts' ) ); }


1 Answer 1


In your screen function ibenic_budypress_my_posts create a redirect. Something like:

function ibenic_buddypress_tab() { 
    bp_core_new_nav_item( array( 'name' => __( 'My Posts', 'ibenic' ), 'slug' => 'my-posts', 'position' => 100, 'screen_function' => 'ibenic_budypress_my_posts', 'show_for_displayed_user' => true, 'item_css_id' => 'ibenic_budypress_my_posts' ) ); 

function ibenic_budypress_my_posts() {
    $url = '/author/' . bp_get_displayed_user_username();
    bp_core_redirect( site_url( $url ) );
  • Thanks but I'm getting a Error; Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW)
    – Hamadi
    Feb 2, 2020 at 15:08
  • Just to clarify I basically replace "ibenic_budypress_my_posts" with the code you have provide, I also tried to paste the code below it I still get the error unexpected 'ibenic_budypress_my_posts' (T_STRING)
    – Hamadi
    Feb 2, 2020 at 15:20
  • I've adjust my answer.
    – shanebp
    Feb 2, 2020 at 22:35
  • Amazing Thank You so much shanebp it work. I really appreciate for your time THANK YOU :)
    – Hamadi
    Feb 3, 2020 at 0:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.