Tagged: profile tabs
I still cant seem to get this to work. Should I be replacing
$tab
with something else? here is what I pasted in php file.`/**
* Modify default tab.
*/
function buddydev_modify_default_tab( $tab ) {if ( ! is_user_logged_in() || bp_is_my_profile() || ! bp_is_active( ‘friends’ ) ) {
return $tab;
}// If both are friends set default tab to profile otherwise activity.
if ( friends_check_friendship( bp_loggedin_user_id(), bp_displayed_user_id() ) ) {
return ‘friends’;
}return ‘my-survey’;
}add_filter( ‘bp_member_default_component’, ‘buddydev_modify_default_tab’ );
Sorry for all the confusion, I’m not great at php.
Hello, when I use the code as provided and go to the profile of someone I am connected with, I get a 404 error.
Yes, when I click on a user Im connected with it goes to 404 page, even though the url populates as https://youryous.com/members/username/.
With the first code provided
/** * 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', 'survey' ); } else { define( 'BP_DEFAULT_COMPONENT', ‘profile’ ); } } add_action( 'bp_setup_globals', 'buddydev_modify_default_tab', 15 );
It directed to profile correctly but I want it to direct to a specific tab on their profile.
Hi Matt,
The code is working correctly. I can see the issue though.It seems you have used the User Profile Tabs Creator plugin to modify the availability and visibility of the friends component/tab.
At the moment, it is not available to the visitors. Since the “friends” tab is only available for the profile owner and not their friends or others, It is causing this error.
Simple solution is to visit Dashboard->Users->Profile Tabs and edit the tab setting for friends/connections and mark it deactivated
Please try
You must be logged in to reply to this topic.