Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I’ve a created wordpress membership site using wishlist member plugin. But I want to have different header.php based on different logins.

Eg: Users are: Print, Web and Free

  1. When Free user logs in – I want header1.php to load and stay till he logs out
  2. When Print user logs in – I want header2.php to load and stay till he logs out
  3. When Web user logs in – I want header3.php to load and stay till he logs out

If nobody has logged in the default header.php stays.

Please assist on how to do this.

Regards, Raghav.

share|improve this question
    
Could you show us some code that you wrote, and tell us what's not working with it? –  Lea Cohen Jan 17 '13 at 11:09
add comment

1 Answer

You can achieve this by getting the Membership Level of the current user, and making a conditional based on this. As I do not have a license for wishlist member, this is untested.

I suppose $member_id to be the same value as the WordPress ID of the logged in User.

<?php 
    global $current_user;
    get_currentuserinfo();
    $member_id = $current_user->ID;
    include('wlmapiclass.php');
    $api = new wlmapiclass('http://yourblog.com/', 'yourAPIKey');
    $api->return_format = 'php'; // <- value can also be xml or json
    $membership = $api->get( /members/{$member_id} );
    $membership = unserialize( $membership );
    print_r( $membership ); // see in which value the actual ID or slug of the membership is stored, I cannot reproduce that..
?>

As TomJNowell pointed out, it would be even better to change the include to

get_header( $membershiplevel );

So you are good to go for future Membership levels.

share|improve this answer
2  
why not just do get_header($membershiplevel); ? Then you'd have header.php header-Free.php header-Print.php and header-Web.php, and it'd be futureproofed if a 4th member type ever came along –  Tom J Nowell Jan 17 '13 at 10:23
    
@TomJNowell of course, silly me, did not think of that ;) –  fischi Jan 17 '13 at 10:29
    
Where actually this script will go? in the themes function.php? –  Raghav Jan 17 '13 at 11:01
    
This script goes to this place where you would normally include your header file, so usually in the page.php or the single.php. You can also make it a function. –  fischi Jan 17 '13 at 11:03
2  
This is a question that is purely related to the wishlist member plugin, so you should ask there for support in this matter. The WordPress-Part, as above, should work this way. –  fischi Jan 17 '13 at 11:04
show 5 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.