I had come up with requirement where I need to provide a auto-login to WordPress blog with Guest user credentials. To accomplish that requirement first I had looked up at available plugins which can let me do that without writing a line of code. Finally I got something similar I wanted and I have modified that and written a plugin to match up that requirement. I owe lot to WordPress; and to add up my little contribution to WordPress community I have generalized that plugin and published it here on my blogs and WordPress Plugins directory.
To be fair this plugin is simple and do not have any interface from where you can configure it. Simply open up the auto-login.php file and edit following configuration array; that's it you are done.
How to configure WordPress Auto-Login ?
It's simple just look at code snippet and you will find out yourself..!
// Allow guest login from Friend URLs. Please specify list of all websites from which guest login is allowed.
// You can choose/specify different user to auto-login them from different websites.
$aFriend[] = array('URL' => 'http://life.digitss.com', 'USER' => 'guest');
$aFriend[] = array('URL' => 'http://www.digitss.com', 'USER' => 'guest');
$aFriend[] = array('URL' => 'http://www.dgtss.com', 'USER' => 'guest');
$aFriend[] = array('URL' => 'http://blogs.dgtss.com', 'USER' => 'guest');
Specify list of friend or ally websites along with USER. Yes, you can specify different User for auto-login from each website. So you can configure those websites based on roles/rights and set them up..!
Download WordPress Auto-Login Plugin

#1 by Richard on February 9, 2010 - 6:16 pm
Quote
Hi there. Many thanks for this really interesting plugin. Looks very useful.
Can you tell us how it works please, technically? I'm trialling it but notice that, when you log out of the guest user account on the password protected site, you're not in fact logged out. I can select http://www.sitename/wp-admin and get straight back into the backend. Why is that?
Another question please is whether it'd be possible to make the autologon dependent on a click-through from a particular page on the referring website, rather than allowing any page on that site's domain to action an auto-logon. So, instead of http://www.sitename.org allowing you in, you'd only be allowed in if you clicked a link to the site from, for example, http://www.sitename.org/pages/auto-login-page. Is that possible?
Many thanks
Richard
#2 by Dharmavirsinh Jhala on December 29, 2010 - 12:56 am
Quote
Hi Richard,
It's possible that you let your visitors login (auto-login) from specific page like http://www.example.org/pages/auto-login-page/
I am really sorry to reply you after really really long time.
I have made some corrections and you can download latest again and let me know if you find any trouble during implementation.
When you logout from guest login it will show you /wp-admin directory as it is the way WordPress treats logout event, if you don't want that for specific user you may need to change that code in WP.
#3 by Toms Skyline Design on July 19, 2010 - 8:29 am
Quote
I installed your plugin. However, rather than allowing only users from one website to bypass the login it allows EVERYONE to bybass the login; which defeats the purpose of having a site locked down. So, it does not appear to work.
#4 by Dharmavirsinh Jhala on July 22, 2010 - 2:46 am
Quote
Hi Tom,
Basically you need to configure this plugin..
Do you have a restricted login on your website?
If yes then you need to put a link to complete page from where you have kept link to your blog..
You can contact me if you have any problem configuring;
Though there seemed to be a bug which has been fixed. You can download another copy and try again..
Good Luck.
#5 by Toms Skyline Design on August 18, 2010 - 11:06 am
Quote
The site I was attempting to use your plugin for is a site that has some pages restricted and other pages open. I thought I had re-written a plugin that was allowing only specified users in; however, I have discovered that it was doing the same as yours. It appears to be allowing everyone in. Also, like the other person who posted, I also discovered that logging out using your plugin or the alternate one I wrote, only kicks the user to the logged out page; when, in fact they are still logged in. It is not clearing any of the cookies. I downloaded your plugin again from the WP site. However, it is Version 1.0 also. Do you have a newer version with a bug fix? I didnt notice any change unless you changed !== to === on one line.
#6 by Toms Skyline Design on August 18, 2010 - 8:43 pm
Quote
Thanks for some of the inspiration. I was able to get my plugin fixed so that it only allows the specifically allowed users to auto-login and when they log out, they are actually logged out. What a pain … but, I got it to work finally.
#7 by Dharmavirsinh Jhala on August 20, 2010 - 11:13 pm
Quote
Cheers…!
If you contribute your snippet it could be great help to others.. Tom.!
#8 by Fida on September 20, 2010 - 11:24 am
Quote
HI
i have a site having registration of users and logging in using the email and password.
I am stucked because i am not able to know how a user looged in from the site needs to logged to WP too.
Please let me know if there exists any plugin in which, when a users logged in from the site URL for Eg: http://www.mydomain.com/login.php
and logged in with his validate username and password, the word press blog also needs to be looged at the same time with the same password. There will be a tables for blogstoo where all the users have a record in the format of wp.
Thanks in advance
Fida
#9 by Dharmavirsinh Jhala on September 20, 2010 - 10:43 pm
Quote
Hi Fida,
If you have tables with mapping between your website and wordpress blog then you can set values in session and when your user clicks on blog link you can extend WP-Auto-Login plugin to verify login username/password hash from session and then you can have that user into WordPress with it's correct login credentials.
Let me know if you need further help.!
Good luck.
#10 by Charles on February 4, 2012 - 9:13 pm
Quote
I need to implement this functionality allowing users at the main site (PHP) to automatically login my wordpress blog by clicking on a link on the main site. How do I go about this? I need a step by step approach for easy understanding. Thanks
#11 by Jeff on December 27, 2010 - 10:15 pm
Quote
I have a client wanting to keep some information private on his website (login required to view certain content). But they want to be able to send email newsletters out that provides access to that private content whether the recipient of the newsletter has credentials or not. I thought maybe passing some sort of unique variable in the URLs embedded in the links in the newsletter might do the trick.
But now I'm wondering if this auto-login might be the right tool. Can you tell me if I'm on the right track? Thanks!
Jeff
#12 by teena on March 24, 2011 - 1:48 am
Quote
Hey I have a question with this plugin. Users need to auto login from any of the website (internal websites) to my blog. For example if there are 3 websites A,B,C which has access to my wordpress blog. Once the users logs in to those websites and access my blog url, if the user id matches with my blog they have to access the blog directly, orlese it needs to ask for login credentials. Instead of 'guests' how can i specify it for all users.
Appreciate if i get a solution ASAP
#13 by Dharmavirsinh Jhala on March 24, 2011 - 11:27 pm
Quote
Teena,
I guess for that we need to modify the code of this plugin. Now as you want it to be more dynamic instead of just ‘guest’ user login, I can see there are 2 possible options:
A) You already have users database synced:
Here you just need to pass username encrypted in query string or post data to your WP blog and there you need to tweak the Auto-Login plugin code to take values from post/query-string decode them and login the correct user.
B) You don’t have users database synced:
Here what you might want to do is pass encrypted username, credentials (role, password) in very secure (with decent encryption if https is not possible) and then in auto-login code you need to check that if the user already exists in the WP users table than you don’t need to create and just have that user login else add record for that user in the wp-users table with provided credentials and have him/her login. It will be just one time next time it will find the user and it will be logged in.
I hope this works for you. It will require little/more modification to the code depending upon your requirement. Good luck.
#14 by teena on March 24, 2011 - 1:59 am
Quote
Hey I have a question with this plugin. Users need to auto login from any of the website (internal websites) to my blog. For example if there are 3 websites A,B,C which has access to my wordpress blog. Once the users logs in to those websites and access my blog url, if the user id matches with my blog they have to access the blog directly, orlese it needs to ask for login credentials. Instead of 'guests' how can i specify it for all users.
#15 by teena on March 31, 2011 - 8:32 pm
Quote
I am using this plugin, but it is throwing a fatal error. Please let me know how can i resolve it. I tried adding the add_action() call in wp-includes/functions.php, nothing worked out.
Fatal error: Call to undefined function add_action() in C:appsApacheApache2.2htdocswordpresswp-contentpluginsdg-auto-logindg-auto-login.php on line 64
#16 by Dharmavirsinh Jhala on March 31, 2011 - 10:40 pm
Quote
Hello Teena,
Please refer following reply on WordPress support forum:
http://wordpress.org/support/topic/call-to-undefined-function-add_action
———————————————-
I figured out what was causing the problem for me. I was trying to call add_action() from the main functions.php file in my WP root. Stopped giving me trouble when I moved the call to the functions.php file inside my current theme.
———————————————-
I hope this will help.!
#17 by Tom on April 4, 2011 - 7:31 pm
Quote
Great plugin! Is it possible to auto-login users from any subdomain on a primary domain? I work with some sites that have several subdomains (dev.mysite.com, test.mysite.com, http://www.mysite.com), and I'd like all users coming from those sites to be logged in without having to add each site individually.
#18 by Will Dangerfield on October 28, 2011 - 8:10 pm
Quote
I am trying to get your plugin to work, but the referring link is a curl request that seems for some reason to stop the login process. Any ideas?
#19 by Dharmavirsinh Jhala on January 15, 2012 - 10:19 pm
Quote
You will need to make required mods to make it work with cURL, or you can provide referring headers in your cURL request.
Let me know if you need any further help.
#20 by Charles on February 5, 2012 - 3:11 pm
Quote
Please I need help. I have a PHP site that allows user authentication and I want those user to auto login to my wordpress blog when they click on a link on the main site (PHP). how do i go about this? I am new to PHP scripting.
#21 by Dharmavirsinh Jhala on March 21, 2012 - 12:07 am
Quote
It's pretty simple download plugin from the above mentioned link on the blog post, extract that file and put it inside your wordpress plugins directory and simply open plugin file make required modifications as mentioned in the comments and if you follow everything properly you should be able to get it working because this plugin does what you are trying to achieve.
#22 by Michael G on March 27, 2013 - 10:21 am
Quote
Hello,
How do I set up the USER criteria in your plugin? I have a 'subscriber' level that I want to implement and have the auto-login set those credentials if that makes sense. I put the site URL in, but where do I put in the UN and PW so the cookie is set?
#23 by Michael G on March 27, 2013 - 7:21 pm
Quote
Hello,
I am hoping you can help me understand how to use your plugin. I have a WP site with a subscriber status that requires a login with Username and Password. Where do I set the variables for this in the code of your plugin? I have changed the referring site, but not sure if I change USER or change 'guest' to match my Username? And what else must I change in order to make this work? Not sure if you have tested it beyond WP3.0 if it will still work.
#24 by Dharmavirsinh Jhala on March 29, 2013 - 4:29 pm
Quote
Hi Michael,
Yes I can guide you to extend this plugin. What you need to do is pass some additional data in URL so that you can access that and then compare that data (as you take into variable) instead of 'guest'.
Give me a day or two and I should be able to look into that, meanwhile you can provide me additional details about how do you store subscriber level and will you be able to pass subscriber level from the referring URL or you will have that stored in wordpress user table only?