Subdomains and login persistence.
-
Bit of background: my blog is set up so that each category appears as a subdomain, so I have http://category1.myblog.com, http://category2.myblog.com, http://category3.myblog.com, etc…
Prior to WP2.3, I was using the following plugin to allow logins that were persistant across each of these subdomains – so that I could display a consistant “Hi, [name] – you are logged in!” type of message on every subdomain, so no matter where the user was on the site, he/she knew they were logged in.
function sd_wp_login($arg){ $cookiepath = COOKIEPATH; $blogurl = get_bloginfo('url'); $blogurl = substr($blogurl, 7); $blogurl = str_replace("www.", ".", $blogurl); $cuser = "wordpressuser_".COOKIEHASH; $cpass = "wordpresspass_".COOKIEHASH; setcookie($cuser, "", time() + 31536000, $cookiepath, $blogurl); setcookie($cpass, "", time() + 31536000, $cookiepath, $blogurl); setcookie($cuser, $_POST['log'], time() + 31536000, $cookiepath, $blogurl); setcookie($cpass, md5(md5($_POST['pwd'])), time() + 31536000, $cookiepath, $blogurl); return $arg; } function sd_wp_logout($arg){ $cookiepath = COOKIEPATH; $blogurl = get_bloginfo('url'); $blogurl = substr($blogurl, 7); $blogurl = str_replace("www.", ".", $blogurl); $cuser = "wordpressuser_".COOKIEHASH; $cpass = "wordpresspass_".COOKIEHASH; setcookie($cuser, "", time() + 31536000, $cookiepath, $blogurl); setcookie($cpass, "", time() + 31536000, $cookiepath, $blogurl); return $arg; } add_filter('wp_login', 'sd_wp_login'); add_filter('wp_logout', 'sd_wp_logout');
However, since WP2.3, I believe cookies and authentication are now handled slightly differently. Can anyone help me out with creating a plugin (or tweaking my current plugin) that will allow logins and authentication to be persistent across subdomains in WP2.3 and higher? I’ve already tried and failed miserably on this one.
Thanks in advance for your help – and if I can get this sorted, I’ll definitely owe you a pint!
- The topic ‘Subdomains and login persistence.’ is closed to new replies.