WP Plugin: Simple Login

I’ve made a WordPress Plugin. I’ve found the Meta widget too big, as I wanted to reduce my sidebar’s length – and I think noone uses anything but the register / login links there, and even those ain’t used very often. So I thought hey, how about a widget which only contains those two? So [...]

May 2nd, 2009 Geekness

I’ve made a WordPress Plugin. I’ve found the Meta widget too big, as I wanted to reduce my sidebar’s length – and I think noone uses anything but the register / login links there, and even those ain’t used very often. So I thought hey, how about a widget which only contains those two? So here’s to you, my first widget: Simple Login. I suppose there’s tons of these out there, but it was a good start for me.

Drop me a comment or a pingback if you’re using it; also any feedback’s welcome (though I don’t know if there’s anything to talk about this pluginette…)

Oh, and disclaimer:

This software comes without any warranty, express or otherwise. Noone makes you to use it, so don’t try to blame me if it does wrong to your blog. (However, a description of the bug might help…)

Get the plugin through the wordpress plugin install dashboard, or here: simple_login

UPDATES:

2011.05.20.

Version 1.2 adds redirect options after a successful login. 1.2.1 is the same, trying to figure versioning out.

2009.06. 06.

Version 1.1 fixes an extra li bug I was told by David and Erlend.

2009. 05. 02.

The plugin was added to the WP repository, you can check it out here:

http://wordpress.org/extend/plugins/simple-login/

36 Responses to “WP Plugin: Simple Login”

  1. David Says:

    Nice plugin. Thank you! Only one change I would make. An empty >> is made at the top of the widget. Code should be changed to following to eliminate. Thanks.

    echo $before_title . $title . $after_title;
    echo ” \n “;
    wp_register();
    echo “\n “;
    wp_loginout();
    echo “\n \n”;
    echo $after_widget;

  2. Edem Says:

    Actually the empty >> doesn’t appear for me (as you can see). Are you sure it isn’t your theme that adds the extra artifacts?
    Also, I used the UL because widget contents are usually in an unordered list so they appear as the others.
    Thanks for the feedback though! :)

  3. Erlend Says:

    The extra li-element appears, and it can be removed by using this, a modification of David’s solution:

    echo $before_title . $title . $after_title;
    echo ” \n “;
    wp_register();
    echo ” \n “;
    wp_loginout();
    echo “\n \n”;
    echo $after_widget;

  4. Edem Says:

    You wrote exactly what he did, actually. I see the problem now, the wp_register() function also includes an extra li element – but if you strip all, the widget won’t work at all anymore.

  5. Nuno Picado Says:

    Hello, and thanks for the plugin – It’s just what I needed, simple and reliable.

    What I’d like is to be able to change the “Login” and “Register” link it creates on de sidebar to my own language (portuguese). Is there any way I can do this? If so, what file?

    Thank you
    Nuno Picado
    (naturpt.nunopicado.com)

  6. Edem Says:

    Actually those links are created by the wp_register() and the wp_loginout() calls, so anything that changes language for the blog engine (and the built-in meta widget) would have to change these too. Try this link: http://codex.wordpress.org/WordPress_in_Your_Language

  7. Nuno Picado Says:

    Thank you very much Edem, it worked like a charm!

  8. Best WordPress CMS Plugins | Another Design by Matt Sweeny Says:

    [...] Simple Login Widget – If you are using WordPress as a CMS, this simple widget will show just the login/logout and register links instead of all the RSS and Meta Feed crap. [...]

  9. Carlos Aguilar Says:

    My blog is http://www.tololoche.com/blog and the plugin instaled succesfuly, the only problem is it does not say Register, only Login.

    Can you please help me, thanks.

  10. Edem Says:

    Have you set the “Anyone can register” on the dashboard / Settings / General page?

  11. Carlos Aguilar Says:

    Dam, me feel like BIG NOOB.

    :P

    That was it, did not remeber to put thant on settings, sorry for that. This is what i get for no taking time to relax and do things 1 step at a itme.

  12. Edem Says:

    It’s okay, I’m glad it’s solved.

  13. Suresh Says:

    I have a problem. When i click on “login”, it basically reloads the home page and does not give me the login screen. I don’t know if it is due to the plugin or not. Also, i am unable to get admin login screen using the URL , http://www.hasya.com/wp-admin.

    Any ideas? how to fix this?

  14. Edem Says:

    Does the login on the default Meta tab work? I doubt this is because of the plugin, it’s more like your wordpress install is corrupted somehow.

  15. Russ Says:

    Hi
    Very nice plugin. Works great. Only one question: How can I change it so that when you click “Logout” it takes you back to the home page of the site? The site I’m using it on is made up of all static pages, no blog pages, so I would like it to pull up the home page when the “logout” link is clicked. Using WordPress mainly as a CMS and it works great!
    Thanks!

  16. Edem Says:

    Unfortunately, that function is not part of this plugin; I wanted to keep it simple. Since 2.8 you can pass a redirect url to the wp_loginout() function, but that will redirect on both login and logout; or you can write an own login-logout function that redirects on logout but not at login. On second thought, that would make a nice plugin, I’ll see if I can find some time to write it (but it might already exist in the plugin repository).

  17. Nigel Carr Says:

    Great plugin for my members to login BIG thanks..

    Is it also possible to conf the plugin to accept login on email address as well as the user name?

    Thanks
    for any help and advice

  18. Edem Says:

    As I said, the widget uses the wp_loginout() and wp_register() functions. If you can set your wordpress to accept the email address globally, this plugin should work that way too. No warranty on that though.

  19. Danno Says:

    Great plug-in…

    Just one thing… my WP is set to Spanish but the plug-in is not translating the whole thing. It still shows “Welcome” and “Options” in English but the links are in Spanish…

    Is this a bug?

  20. Edem Says:

    “Welcome” and “Options”? This widget shouldn’t contain any of those. Also, it uses the API calls for the links, so I suspect it might be a translation based bug. Can you throw me a link to edem at thinkedem.hu so I can check it?

  21. Danno Says:

    I just realize that the translation fails when adding the code to the template but it works fine when used as a widget… better look into it.

    The website is on my nickname.

    Cheers

  22. Edem Says:

    Yes, it is intended to be used as a widget. It seems working now.

  23. carine ferry Says:

    Hi, I have activated the plugin and the widget, checked the option “anyone can register”, but it only shows the login option.. is there anything I have forgotten? Thanks!

  24. Edem Says:

    I guess you’ve Saved the changes. Does the original Meta widget work as it should, or is that “broken” as well?

  25. Dima Says:

    I suggest the following small change, in order to avoid displaying an empty Title. In some themes that looks ugly.

    @28
    <> if(!empty($title)) {
    echo $before_title . $title . $after_title;
    }

  26. Edem Says:

    Good idea, I’ll try to look into it some time this week.

  27. Dyce Says:

    Is there a way to code this into my theme instead of using the widget?

  28. Uwe Says:

    Hey, thanks for the wonderful “little” PlugIn.
    There’s one wish, after Login the user see “Admin” (witch is the user-dashboard) and “Anmelden” (german for LogIn). Is it possible to change the “admin” in “profile” fpr example?

    I didn’t found a way in the php.

    Thanks for your trouble.
    Regards
    Uwe

  29. Edem Says:

    Hi, thanks for the positive feedback.
    Actually that “Admin” is taken from the language localisation, so you would need to change the system-wide german language file. (I try to keep the plugin as simple as possible.)

  30. Edem Says:

    Hi, since the plugin has some configurations, and I try to make it simple, I never tried to make it available via a function call. If you’re okay with static configuration, you could try to copy the code from the widget’s widget_simple_login function, should be simple enough. Or feel free to make a version with an options page configuration and a function call.

  31. Jo Says:

    Hey, great plug-in, was exactly what I was looking for. Only one hitch: I need clients to be able to log in and be redirected to their own private page. I’ve tried using [variable]username[/variable] in the custom redirect field, but it apparently can’t read variables…? Suggestions?

  32. Edem Says:

    No, this plugin doesn’t handle variables. The selected page is handed to wp_loginout without any parsing. These predefined options were satisfying for my own needs, implementing custom variables is possible, but was too time consuming at the time. :) If you’d like to implement it, you need to parse $option['redirectto'] and set $redirect accordingly, in the widget_simple_login function. (Look for the switch at around line 26.)

  33. Marc Says:

    Thanks for the plug-in. Heaps better than Meta. Can you tell me if I can erase the “Site Admin” link that is displayed after logging in? I want one level of user to not access the dashboard but still access private content on the frontend.
    Cheers

  34. Edem Says:

    Deleting the link wouldn’t stop them being able to access the dashboard, though if they are not site admins, there’s only a few things they can do there. (Create a Subscriber test account and login to see what can they access.) Currently you can’t remove the site admin link, but I might add the option if I find the time (which is not likely for a while unfortunately).

  35. Marc Says:

    Hi Edem
    Is it difficult to add a link into the widget when logged in?
    I would like to have a link to a specific page that only displays in the widget when the profile is logged in.
    Can this be done?
    Cheers
    Thanks for all your help.

  36. Edem Says:

    I guess it wouldn’t be too difficult, but it kind of goes against the goal of the widget, that is being as simple as possible. Actually I don’t even check for the user being logged in, because the called functions printing the links do that already. But you could always use a plugin which hides pages from guest visitors, that also hides their links – I’m using WordPress Access Control for that.

Leave a Reply