Pro: Dedicated header for logged in Memberpress users

Hi,

I am in the process of building a members website using Pro and MemberPress.

I have a header designed for public (non signed in users) and another header for signed in Members but cannot get the members header to display based on membership status

within the header builder, I can see the various member levels but they don’t affect the header selected on my website

I can manually select each page but that is not a sustainable option for the client going forward

Can you help please

Hey Scot,

This would require both a MemberPress conditional and our Header Assignment filter.

For the MemberPress conditional, you’ll need to contact MemberPress support to give you the plugin’s user logged in and logged out conditionals. The reason I pointed to MemberPress is because they might have different conditions than WordPress’. See https://developer.wordpress.org/reference/functions/is_user_logged_in/

On our side, you’ll need to use cs_match_header_assignment. Here are some usage examples by Michael Bourne: https://michaelbourne.ca/assign-pro-header-search-results-page/

Hope that helps.

Perfect response, thank you

this code did the trick

add_filter(‘cs_match_header_assignment’, ‘custom_search_header’);
function custom_search_header($match) {
if (is_user_logged_in()) {
$match = 1234; // the post ID for your header
}
return $match;
}

You’re welcome, Scot. Glad it helped.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.