Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change default user profile sub navigation


  • jessy
    Participant

    @jessy-marco

    function bp_change_default_profile_sub_nav() {
    	if ( bp_is_user_settings() ) {
    		global $bp;
    		$args = array(
    			'parent_slug'     => $bp->settings->slug, // Slug of the parent
    			'subnav_slug'     => 'profile',  // The slug of the subnav item to select when clicked
    		);
    	bp_core_new_nav_default($args);
     	}
    }
    
    // Change default sub navigation of profile settings main tab navigation
    add_action( 'bp_setup_nav', 'bp_change_default_profile_sub_nav', 5);
    

    My Error:
    Notice: Undefined index: settings in /opt/wordpress-4.0-0/apps/wordpress/htdocs/wp-content/plugins/buddypress/bp-core/bp-core-buddybar.php on line 144

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

  • GLCox
    Participant

    @glcox

    Jessy, At the risk of showing how much of a novice I am, would you show me which line(s) are immediately above and below where I should put:
    add_action( ‘bp_setup_nav’, ‘bp_change_default_profile_sub_nav’, 5);

    and also, where I should insert the entire: function bp_change_default_profile_sub_nav()

    I think your solution will solve my default/current user profile sub navigation problem.
    Currently, when I select my picture, username, Edit My Profile, or Profile -> Edit, it default to the BP Group page.

    If you think your solution is NOT the answer, I’d appreciate your advice/guidance.
    GLCox


    jessy
    Participant

    @jessy-marco

    Your thinking is on the right way. 🙂

    Go to plugins directory and create file: bp-custom.php and the whole code just paste there and wrap it all by php tags: <?php ?>


    jessy
    Participant

    @jessy-marco

    You can share your nice website, if you like 🙂


    GLCox
    Participant

    @glcox

    I have to do the file creation with Notepad, then FTP the file into BP.

    Is this correct? directory and filename: buddypress/bp-core/bp-custom.php

    <?php
    function bp_change_default_profile_sub_nav() {
    if ( bp_is_user_settings() ) {
    global $bp;
    $args = array(
    ‘parent_slug’ => $bp->settings->slug, // Slug of the parent
    ‘subnav_slug’ => ‘profile’, // The slug of the subnav item to select when clicked
    );
    bp_core_new_nav_default($args);
    }
    }
    ?>

    where do I put?:
    add_action( ‘bp_setup_nav’, ‘bp_change_default_profile_sub_nav’, 5);


    jessy
    Participant

    @jessy-marco

    Directory: wp-content/plugins/bp-custom.php

    Paste there this code, everything, just like it is:

    function bp_change_default_profile_sub_nav() {
    	if ( bp_is_user_settings() ) {
    		global $bp;
    		$args = array(
    			'parent_slug'     => $bp->settings->slug, // Slug of the parent
    			'subnav_slug'     => 'profile',  // The slug of the subnav item to select when clicked
    		);
    	bp_core_new_nav_default($args);
     	}
    }
    
    // Change default sub navigation of profile settings main tab navigation
    add_action( 'bp_setup_nav', 'bp_change_default_profile_sub_nav', 5);

    GLCox
    Participant

    @glcox

    I put the code named bp-custom.php, with <?php above the function statement and ?> below the add_action statement, in the directory wp-content/plugins/. There was no improvement, so I changed its permissions from 644 to 755. No change. Next, I moved bp-custom.php into the directory wp-content/plugins/buddypress with the 755 permissions. Still no improvement. I am beginning to think my BP directory/sub-directories, etc. are not what they should be.

    I think I need to completely remove BP and all the local/user webpages I’ve created, read through the installation instructions again, then re-install. Let me do this, then get back to you if necessary. garyc


    jessy
    Participant

    @jessy-marco

    Paste “add_action statement” also to the same place within your <?php ?> tags, otherwise it will no work.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Change default user profile sub navigation’ is closed to new replies.
Skip to toolbar