Jump to content

How to have different header.php based on the user logged in


vraghav

Recommended Posts

Hi

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

 

When Free user logs in - I want header1.php to load

When Print user logs in - I want header2.php to load

When Web user logs in - I want header3.php to load

 

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

 

Please assist on how to do this.

 

Regards,

Raghav.

Link to comment
Share on other sites

Hey TRQ,

 

Thanks for the response, please can you elaborate on how to use that. Different levels(Print, Web, Free) - different headers (header1, header2, header3)

 

How to use if() function for the levels? Am working it out for a client. Please assist.

 

Thanks.

Link to comment
Share on other sites

For a client? You mean someone is paying you to figure this out?

 

An if statement will allow you to change the execution path within your program. This allows you to make choices based on different data.

 

It's a simple concept:

 

if ($that) {
  // do that
} else {
  // do something else
}

 

Now, all you need to do is figure out what data you need to check in your conditions and what code to execute when your checks pass.

 

Link to comment
Share on other sites

  • 3 weeks later...

You are checking the user type from database for logged in users?

 

<?php

if($userType="Free"){

?>

<?php include("header1.php");?>

<?php } elseif($userType="Print") { ?>

<?php include("header2.php");?>

<?php } else { ?>

<?php include("header3.php");?>

<?php } ?>

Link to comment
Share on other sites

P5system,

 

If you post replies on a php help forum with code that has an opening and closing php tag on every line, you are going to start receiving replies that point out every short-coming with that code, such as how bad code like that looks, and how hard it is to troubleshoot even basic syntax errors in code written like that.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.