Skip to:
Content
Pages
Categories
Search
Top
Bottom

Fixing deprecated bp_nav code?


  • katmacau
    Participant

    @katmacau

    I have inherited a Buddypress site and have this error:

    bp_nav was called incorrectly These globals should not be used directly and are deprecated. Please use the BuddyPress nav functions instead.

    I have found where it is being used. Eg:

    global $bp;
    $bp->bp_nav[‘notifications’] = false;

    But I cannot find on the documentation what the new Buddypress nav functions should be to replace this? please help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @katmacau-

    Here are some examples for changing navigation menus using the new API:

    Navigation API

    This is what I’m guessing you’ll want to use:

    
    function bpcodex_remove_member_notifications_tab() {
    	bp_core_remove_nav_item( 'notifications' );
    }
    add_action( 'bp_actions', 'bpcodex_remove_member_notifications_tab' );
    

    One question though: if you’re not using the notifications, why not just turn off the notifications component in the BuddyPress settings screen in wp-admin?


    katmacau
    Participant

    @katmacau

    Thanks for that. That was just a snippet of the code I’ve inherited in a theme I am using. There are multiple remove nav items so that code will work for those.

    The other two deprecated functions I have in there include lines like this:

    $bp->bp_options_nav[‘dashboard’][‘edit-conpany-profile’] = false;

    And:

    if ($bp->current_component != “membership”)

    What is the new code for ” $bp->bp_options_nav” and “$bp->current_component”?

    Thanks in advance.


    katmacau
    Participant

    @katmacau

    I also have one where I set a value of a bp_nav item. Eg:

    $bp->bp_nav[‘friends’][‘name’] = “New label”;

    What new code would I use for that?

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