@officeninjas
8 years, 6 months ago
Thanks @r0z for the elegant solution.
I would just add that in order to prevent PHP Notices, change the qualifier to the following:
if ( function_exists( 'buddypress') && ( !empty( buddypress()->displayed_user->id ) || !empty( buddypress()->current_component ) ) ) {