BuddyDev

Search

Replies

  • Participant
    Level: Initiated
    Posts: 13
    Matthew Ling on in reply to: [Resolved] Default Tab for Connected Members #35252

    Hi, unfortunately I haven’t been able to get this to work. Here are the contents of my bp-custom file.
    Sorry if this is a duplicate, not sure if the code would have been received because I didnt use the `.

    <?php
    
    add_filter( 'bp_auto_friendship_pro_enable_on_user_register', '__return_true' );
    
    /**
     * Modify default tab.
     */
    function buddydev_modify_default_tab() {
    
    	if ( ! is_user_logged_in() || bp_is_my_profile() || ! bp_is_active( 'friends' ) ) {
    		return;
    	}
    
            // If both are friends set default tab to profile otherwise activity.
    	if ( friends_check_friendship( bp_loggedin_user_id(), bp_displayed_user_id() ) ) {
    		define( 'BP_DEFAULT_COMPONENT', 'connections' );
    	} else {
    		define( 'BP_DEFAULT_COMPONENT', 'profile' );
    	}
    }
    
    add_action( 'bp_setup_globals', 'buddydev_modify_default_tab', 15 );

    FYI – the auto connect users is working correctly. it is the default tab to display if two people are connected that I can’t figure out.

    Any help is greatly appreciated. Thanks, Matt

  • Participant
    Level: Initiated
    Posts: 13
    Matthew Ling on in reply to: [Resolved] Default Tab for Connected Members #35251

    Hi, unfortunately I haven’t been able to get this to work. Here are the contents of my bp-custom file.

    <?php

    add_filter( ‘bp_auto_friendship_pro_enable_on_user_register’, ‘__return_true’ );

    /**
    * Modify default tab.
    */
    function buddydev_modify_default_tab() {

    if ( ! is_user_logged_in() || bp_is_my_profile() || ! bp_is_active( ‘friends’ ) ) {
    return;
    }

    // If both are friends set default tab to profile otherwise activity.
    if ( friends_check_friendship( bp_loggedin_user_id(), bp_displayed_user_id() ) ) {
    define( ‘BP_DEFAULT_COMPONENT’, ‘my-survey’ );
    } else {
    define( ‘BP_DEFAULT_COMPONENT’, ‘profile’ );
    }
    }

    add_action( ‘bp_setup_globals’, ‘buddydev_modify_default_tab’, 15 );

    FYI – the auto connect users is working correctly. it is the default tab to display if two people are connecting that I can’t figure out.

    Any help is greatly appreciated. Thanks, Matt

  • Participant
    Level: Initiated
    Posts: 13
    Matthew Ling on in reply to: [Resolved] Default Tab for Connected Members #35231

    Ok, thanks so much. Just to be sure, what php file should this be added to?