vraghav Posted January 15, 2013 Share Posted January 15, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/273179-how-to-have-different-headerphp-based-on-the-user-logged-in/ Share on other sites More sharing options...
trq Posted January 15, 2013 Share Posted January 15, 2013 See if. Quote Link to comment https://forums.phpfreaks.com/topic/273179-how-to-have-different-headerphp-based-on-the-user-logged-in/#findComment-1405802 Share on other sites More sharing options...
vraghav Posted January 15, 2013 Author Share Posted January 15, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/273179-how-to-have-different-headerphp-based-on-the-user-logged-in/#findComment-1405832 Share on other sites More sharing options...
trq Posted January 15, 2013 Share Posted January 15, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/273179-how-to-have-different-headerphp-based-on-the-user-logged-in/#findComment-1405841 Share on other sites More sharing options...
P5system Posted February 5, 2013 Share Posted February 5, 2013 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 } ?> Quote Link to comment https://forums.phpfreaks.com/topic/273179-how-to-have-different-headerphp-based-on-the-user-logged-in/#findComment-1410165 Share on other sites More sharing options...
PFMaBiSmAd Posted February 5, 2013 Share Posted February 5, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/273179-how-to-have-different-headerphp-based-on-the-user-logged-in/#findComment-1410178 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.