Archived topic
Page Hero for User Profiles
8 replies · Started by Karin und Alfred on August 31, 2021
Hello,
I try to activate a custom Page Hero for the user profiles pages.
Unfortunately the page hero is always missing on the user profile pages.
Could also not find a special location for that in the locations drop down.
How can I achieve this?
e.g. like here when I click on User Profile, the header also not disappears.
BR Alfred
To specify my question a little bit. I tried to use that code to include the header on the user profile page:
/*Forum Page Header for forum author and users*/
add_filter( 'generate_page_header_id', function( $id ) {
if ( is_author() ) {
return 81; // ID of the Page Header to use.
}
return $id;
} );
That's how the header should look like: 
That's how it looks when going to the user profile: 
Hi there,
would it be possible to see a User Profile page so i can see what template is using ?
Here you are:

It's just the standard WP template.
I need to see the actual site, any chance you can set me up a temporary profile, login and url to that page?
You can share that information in the Private Information field.
See attached
Hi there,
Found this: https://bbpress.org/forums/topic/check-if-on-user-profile-page/
So you should be able to do this:
add_filter( 'generate_element_display', function( $display, $element_id ) {
if ( 123 === (int) $element_id && bbp_is_single_user_profile() ) {
$display = true;
}
return $display;
}, 10, 2 );
You'd just need to update 123 with the ID of the Element.
Hej,
Thanks! That was the right hint I was searching for.
I used is_bbpress() instead of bbp_is_single_user_profile().
The following code did the job:
add_filter( 'generate_element_display', function( $display, $element_id ) {
if ( 199 === (int) $element_id && is_bbpress() ) {
$display = true;
}
return $display;
}, 10, 2 );
Also works fine with the BuddyPress plugin.
BR Alfred
Great to hear - thanks for sharing your code! :)