External login using the WordPress 2.7 login system
– Note, this is updated to work with WordPress 2.7 –
I needed a way of letting users in a Wordpress blog be able to login to a different website on the same domain (for example, if you want to host a web portal of some kind that shares the user system of your hosted wordpress blog, making it easier for your users to only need one account on your site). Googled the idea and found nothing, so worked it out for myself.
These are the steps for WordPress 2.7. There is only one difference, and that is in editing the login.php file to work with logging out.
First, your site needs to include the wp-config.php file.
include_once($_SERVER['document_root'].”/blog/wp-config.php”);
Then, edit your config file to contain the following extra lines (note, users will have to log in again after doing this): (more…)