WordPress Sidebar Login 2 – Optimised for wordpress 2.6
At last! My sidebar login widget has evolved into ‘Sidebar Login’ which has both a widget and a template tag to allow you to have a login form in the sidebar of your wordpress powered blog.
It lets users login, and then redirects them back to the page they logged in from rather than the backend, it also shows error messages. Read more for more information and the download link.
Sidebar Login
Sidebar login is self explanatory really; it allows users to login to wordpress from the sidebar! This plugin requires wordpress 2.6 (that is all I have tested) in order to function; this is because wordpress 2.6 has a modified login system to older versions.
Screenshots

Login Form

Logged in
Change Log
You can track changes to the plugin in the wordpress plugin SVN.
Get it now!
You can get the latest version from the wordpress plugin database; Download it here!
Installation Instructions
- Unzip and upload the php file to your wordpress plugin directory
- Activate the plugin
- For a sidebar widget: Goto the design > widgets tab – Drag the widget into a sidebar and save!
- To use the template tag: Add
<?php sidebarlogin(); ?>to your template.
License
WordPress Sidebar Login © Copyright 2008-current. Mike Jolley
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
optimised
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Show your support – ensure continued development
I put a lot of effort into all of my plugins; its thirsty work so why not show your support by buying me a nice coffee
Found this post useful? Why not buy me a coffee!










Will says:
Great work with this Mike. I’m sure I can make use of it!
Thanks.
Comment made on July 23, 2008 at 12:58 pm
Anthony says:
Glad to see you’ve updated this, I agree its a useful plugin, great for multi author blogs etc.
Comment made on July 23, 2008 at 2:18 pm
nora says:
hi… I’ve made minor changes to your original code and everything was fine until the moment when I tried to logout… than I got this:
Warning: include_once(wp-settings.php) [function.include-once]: failed to open stream: No such file or directory in /home/teatar/public_html/wordpress/wp-content/plugins/sidebar-login.php on line 84
Warning: include_once() [function.include]: Failed opening ‘wp-settings.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/teatar/public_html/wordpress/wp-content/plugins/sidebar-login.php on line 84
Warning: Cannot modify header information – headers already sent by (output started at /home/teatar/public_html/wordpress/wp-content/plugins/sidebar-login.php:84) in /home/teatar/public_html/wordpress/wp-content/plugins/sidebar-login.php on line 88
Any ides how to solve this?
Comment made on July 24, 2008 at 7:06 pm
Mike Jolley says:
change the path of the include_once() in the plugin; its possible your blog has it somewhere else (is your wordpress installed in the site root?)
Comment made on July 25, 2008 at 1:46 am
Falcon1986 says:
I have been looking for a plugin like this for quite some time. It works splendidly with my WordPress 2.6 blog. Thank you!
Comment made on July 25, 2008 at 5:41 am
mick says:
I like the direction of your plugin. I intent to use it for a site providing lessons and course material to logged in users. Unfortunately I have been unable to get it to work. To ensure this was not due to any edits I had made, I did a clean install of wp 2.6 with a fresh db into its own folder inside the web root with wp sidebar login as the only plugin present. I created one subscriber.
Default login works as expected.
Sidebar login widget displays the login form as expected with the form action set to the current page url.
If a user is logged in by the Default login method, sidebar login displays dashboard, profile and logout links. these links work.
Problem is that the login form is not working for me. When a user and password is entered it returns the empty form on the same page with no errors, but with no-one logged in.
Any ideas on the solution would be appreciated. Thanks.
Comment made on July 27, 2008 at 9:45 am
Photographion says:
I’ll try it
Comment made on July 27, 2008 at 6:40 pm
mick says:
My login problems have been found and fixed.
The problem was cookies. They had www on them while my site is authoritively non www (It has a .htaccess permanent redirect away from the www url)
My code to fix this goes at line 156 of sidebar-login.php after this block;
if ($url == “nologout” && strstr($pageURL,’logout’)==true) {
$pageURL = str_replace(‘?logout=true’,”,$pageURL);
$pageURL = str_replace(‘&logout=true’,”,$pageURL);
}
The added code is;
//————–
if (strstr(get_bloginfo(‘wpurl’),’www.’)) {
}
else {
$pageURL = str_replace( ‘www.’, ”, $pageURL );
}
//——————–
I imagine it is formed in an ugly way to a purist php developer, and it may even be in an illogical location, but it works.
Having said this I have not tested it on a www url site (I don’t have any.)
Please feel free to use this code or a better version of it.
ps. This plugin elegantly solves the problem of non admin login for wordpress and is just what I needed. Thanks.
Comment made on July 28, 2008 at 9:00 am
Jamie Le Souef says:
Fantastic plugin! i have clients that need something exactly like this. Thanks
Comment made on July 29, 2008 at 2:09 am
wasabi says:
I created a static page with sidebar login widget, everytime I tried to logout the user, it always free up the page, because this page is not located at document root, any suggestion?
Comment made on July 30, 2008 at 8:31 pm
Mike Jolley says:
I think there may be path problems with non-root installs – will be moving to SVN in the coming days with a fix.
Comment made on July 31, 2008 at 10:11 pm
Hawkslayer says:
I’ve installed the sidebar login widget and it appears to be fine when I log out and login again. Just one thing, I don’t have the “register” link that you have on your example and I would like to have that. Can you tell me how to enable it please?
Comment made on August 2, 2008 at 1:16 am
Hawkslayer says:
I forgot to mention in my previous post that I’m not very hot with PHP, if anyone makes any suggestions regarding the “register” link, please make them in layman’s language.
Hawkslayer..
Comment made on August 2, 2008 at 1:22 am
Mike Jolley says:
@Hawkslayer – Wp-admin Settings>General tick the “anyone can register” link
Comment made on August 2, 2008 at 12:47 pm
Hawkslayer says:
Mike – I’m using WordPress-mu and it doesn’t have that option. guess I should have mentioned I was using MU when I asked the question. The option is does have is: “Users must be registered and logged in to comment” and I do have this enabled.
Under site admin/options it does have these choices:
* Disabled
* Enabled. Blogs and user accounts can be created.
* Only user account can be created.
* Only logged in users can create new blogs.
* Disable or enable registration and who or what can be registered. (Default=all)
I selected: Enabled. Blogs and user accounts can be created.
Si I guess this version of sidebar doesn’t work on mu. Sorry about that I really like it.
Hawkslayer..
Comment made on August 2, 2008 at 2:12 pm
Tom Johnson says:
Thank you. Thank you! THANK YOU! for making this plugin. This is exactly what I needed for my site. Very appreciative of your efforts. I’m using the Prologue theme and needed an external login like this.
Tom
Comment made on August 2, 2008 at 4:44 pm
Hawkslayer says:
Hurrah!! I found the key to allowing users to register and now the link to register shows up.
It is in site admin/blogs, open the blog and there it is, “allow users to register” put an 1 in it and the register link shows up on the sidebars and the login page. Thanks for bearing with me on this. I’ll most likely be back with other problems.
Hawkslayer..
Comment made on August 2, 2008 at 6:59 pm
hanjra says:
wow, great plugin… i was really looking for it which works in the template too and not only as widget. I am going to test it. If it works for me, i will really thankful to you. cheers
Comment made on August 3, 2008 at 8:00 am
hanjra says:
It works.. thanks a lot dear… but i removed dashboard and profile link after you login as i dont want users to see the backend at all. Still testing…
Comment made on August 3, 2008 at 8:27 am
hanjra says:
oh no, when i removed those links, i received errors,, i receive only blank screen after i click login… can you help me to be not shown those link after login.
Comment made on August 3, 2008 at 8:59 am
Mike Jolley says:
@hanjra – Should just remove:
<li class="page_item"><a href="'.get_bloginfo('wpurl').'/wp-admin" rel="nofollow">'.__('Dashboard').'</a></li><li class="page_item"><a href="'.get_bloginfo('wpurl').'/wp-admin/profile.php" rel="nofollow">'.__('Profile').'</a></li>
On line 28. That should not cause any problems.
Comment made on August 3, 2008 at 9:08 am
hanjra says:
@ mike this what i did, but after that i receive a blank page whenever i click login in the sidebar, and even i cant login and if i dont remove those lines, its ok. and when i login i dont see USER NAME after the welcome … shouldnt it be there?? Anyway i just removed your plugin for further testing.
Comment made on August 3, 2008 at 10:01 am
Hawkslayer says:
I have another minor irritation. When I am logged in and have the WELCOME sidebar up, if I click on dashboard, it reports “page not found” the other two links in the sidebar work fine. I am using wordpress-mu.
The other link I have to admin works correctly. Any ideas?
Comment made on August 3, 2008 at 1:43 pm
Mike Jolley says:
@hawkslayer – I never stated it would work for MU – the links are different. For example the reg page is wp-signup.php. I suggest you go to your dashboard to find the correct url and manual add it to the plugin in place of whats there.
Comment made on August 3, 2008 at 1:52 pm
Hawkslayer says:
Thanks Mike – I have already done what you suggested and it works fine.
The line read:
‘.__(‘Dashboard’).’
I added /index.php thus:
‘.__(‘Dashboard’).’
Everything now appears to be working like it should in MU. Thanks for being patient with me.
Hawkslayer.
Comment made on August 3, 2008 at 2:46 pm