Hi all, I have a site that is split into domestic and commercial tabs, much like whats over at British Gas' website. Once a user selects one or the other, a different stylesheet is loaded on the page to give a diffferent user experience. I'm using PHP Sessions to differentiate customers once they have selected Commercial. I also have a few fail safes - some pages, dependant up on their page parents will have commercial or domestic in the URL. If they are present, the Session is set again. Some pages are not specific to either of the two sections, i.e. FAQ's and contact us, but I still want it to reflect the stylesheets of the customer type who is logged in. If I click onto one of these pages which doesnt reinforce the PHP SESSION, then click onto another, the Session data is lost. Any thoughts? session_start(); if (is_page_or_ancestor(882)): $_SESSION["UserType"] = 2; elseif (is_page_or_ancestor(916)): $_SESSION["UserType"] = 1; endif; if (inStr("commercial", get_permalink())){ $_SESSION["UserType"] = 2; } elseif (inStr("domestic", get_permalink())){ $_SESSION["UserType"] = 1; } PHP: (I've got an InStr function defined in the form of InStr(needle, haystack) Any help or thoughts would be appreciated!!!
Its at the top of the wordpress file, after the comments, but there is no space between the comment block and the start of the session_start.
do you use header: location redirects in this site? in case you do you might try to replace your single line redirect with this: session_regenerate_id(true); header("Location: ".$dest); die(); Code (markup): let me know if this fixes it
I dont use header redirects, the Session variable simply lets me choose to laod two different stylesheets