bp_init | get displayed user
-
Hi,
befor I updated to V12 I used bp_init hook to set the default profile tab by using BP_DEFAULT_COMPONENT. In my case I set a new default tab only on the users own pages like this:
function set_profile_default_tab() { global $bp; if ( bp_is_user() ) { $current_user = get_current_user_id(); $displayed_user = $bp->displayed_user; $displayed_user_id = $displayed_user->id; if ($current_user == $displayed_user_id) { $default_tab = 'dashboard'; if ( ! empty( $default_tab ) ) { buddypress()->active_components[ $default_tab ] = 1; // Set Default Tab define( 'BP_DEFAULT_COMPONENT', $default_tab ); } } } } add_action( 'bp_init', 'set_profile_default_tab', 99 );
But after update this isn’t working. I’m not able to get the user id of the displayed user.
Has anyone an idea how to get the user id of the displayed user while using the bp_init hook?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.