Jump to content
Sign in to follow this  
bizassure

Change Headers based on User Role

Recommended Posts

bizassure

I'd like to change the header of my site based on user roles. I've put together the following, but since I am not an expert, it's crashing my site. Any help would be greatly appreciated! Thanks :)

	add_action('pagelines_before_branding_icons','add_image_to_header');
	
		function add_image_to_header() {?>
			

The site is: http://tempbiz.bizassure.com/professional/

Share this post


Link to post
Share on other sites
bizassure
The user role as in Admin, Editor, etc. I am also using the Members plugin to create roles and would like to use those roles as well. Thanks!

Share this post


Link to post
Share on other sites
Danny
Hi Bizassure, I've just checked out your site and it looks fine to me, is this issue resolved ?

Please search our forums, before posting!

Share this post


Link to post
Share on other sites
bizassure
No. I'm still looking for a resolution. The goal is that each user would see a different header when they login. The header they see would be determined by their role. Any suggestions?

Share this post


Link to post
Share on other sites
rtysmith
Yes, I've done this, had to do in two parts, one for the background (via CSS) and one via functions.php for the content. I am using magicmembers.com, so the roles will be specific to that, but here is the code I used for functions.php: [code] function add_icons_to_branding(){ global $current_user; get_currentuserinfo(); $mgm_member = mgm_get_member($current_user->ID); if (mgm_user_is('pro_implementer_member')){ ?> display_name . "n"; ?> (Implementer) | Membership Profile | Logout | display_name . "n"; ?> (Implementer) | Membership Profile | Logout | display_name . "n"; ?> (Free Member) | Upgrade Membership | Membership Profile | Logout | Join the Community | Login |
EOS Business Coaching
Learn about the EOS Business Coaching Tools in TRACTION
[/code] I only needed two logos based on where they were located in the site, so (the $grandparent test is from wordpress.org): [code] function community_header_image() { if(is_page( 'training' ) || $grandparent == 1030 || 1030 == $post->post_parent):?> ; ;

Share this post


Link to post
Share on other sites
Danny
Awesome, thanks @rtysmith

Please search our forums, before posting!

Share this post


Link to post
Share on other sites
bizassure
Thanks so much to everyone for helping! Here's what I put together: [code] add_filter ( 'pagelines_site_logo', 'afilter'); function afilter($site_logo){ global $wp_roles; if ( current_user_can( 'subscriber' ) ) $site_logo = sprintf( '', '/home/', get_bloginfo('name'), esc_url(pagelines_option('pagelines_custom_logo')), get_bloginfo('name')); elseif ( current_user_can( 'contributor' ) ) $site_logo = sprintf( '', '/home/', get_bloginfo('name'), esc_url(pagelines_option('pagelines_custom_logo')), get_bloginfo('name')); elseif ( current_user_can( 'editor' ) ) $site_logo = sprintf( '', '/home/', get_bloginfo('name'), esc_url(pagelines_option('pagelines_custom_logo')), get_bloginfo('name')); elseif ( current_user_can( 'author' ) ) $site_logo = sprintf( '', '/home/', get_bloginfo('name'), esc_url(pagelines_option('pagelines_custom_logo')), get_bloginfo('name')); return $site_logo; } [/code]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×