Simple customization of WordPress Sidebar Login Plugin

I came across this great WordPress plugin yesterday called Sidebar Login. Like the name says, it lets you place a login form in your WordPress sidebar so you can bypass the typical WP login screen. I thought the plugin would be a nice addition to a site I’m finishing up at work. Here’s what it looks like on my site:



It pretty much works as advertised. Like most WP plugins it’s easy to install and activate. To bring it up in your sidebar, you use the nifty template tag:

< ?php sidebarlogin(); ?>

Simple enough. Though it does have one quirk I’d like to point out. When you login with Sidebar Login, it has a pleasant “welcome” greeting, followed by your Username. Like so:

Kinda silly, huh? I think a better behavior for this would be to to use your “Display Name” so it’s a bit more personalized. So instead of in my case displaying “Admin,” it’ll display “Stevie,” which I have setup in the WP Dashboard:

All it takes is a little consultation with the WordPress Codex to produce this helpful document, Function Reference/get userdata to find the info we need.

In the code to the plugin, on or around Line 26 there you’ll find this:

echo $before_widget . $before_title . __("Welcome "). $user_info->user_login  .$after_title;

What we need to do is change $user_info->user_login to use $user_info->display_name. Here is the complete revised line:

echo $before_widget . $before_title . __("Welcome "). $user_info->display_name  .$after_title;

Enacting this change will now display your “Display Name” after you login. Problem solved:

The documentation for this plugin is not very complete so I did a Google search to see if others had this quandary. Much to my surprise I didn’t find anything so I thought I’d share what worked for me.

Thanks to the documentation at the WP Codex and reading through some PHP code, it was a quick solution. Take a look at the document at WP Codex to further experiment with your greeting.

Also thanks to Mike Jolley and his excellent Sidebar Login plugin!

Update 4/20/2009:
Sidebar Login has been updated so it now uses “Display Name” by default.

5 Responses to “Simple customization of WordPress Sidebar Login Plugin”

    • Stevie

      I was using the WP Events Calendar plugin. At the time, I hacked the plugin to display this link. With the newer versions of Sidebar Login you can add custom links in the admin area. It really is an excellent and versatile plugin.