Home > Coding, WordPress > My first WordPress plugin: AJAX Login Widget++

My first WordPress plugin: AJAX Login Widget++

February 22nd, 2009

Today I decided that did not really like the how WordPress handled user logins. Whenever you want to login, it whisks you away from what you were reading and onto a very empty login page. Once you have logged in, in tends to whisk you off somewhere new. Worse, when you logout it again takes you away from the page you were on to show you a blank login page. Thus I headed back to the WordPress plugins directory in search of something better.

What I found was a nifty plugin named AJAX Login which (surprise) used AJAX to handle almost all login processing within the page the user was on. Unfortunately, it had not been updated in over a year and was no longer compatible with the latest version of WordPress. Thus I started hacking on it and ended up making a number of improvements to its UI and how it handled AJAX calls. Anyway, I decided to package it up as a new plugin — you can get the plugin and read all the details about what it does here.

Its official location in the WordPress plugins directory is at http://wordpress.org/extend/plugins/ajax-login-widget/!

David Underhill Coding, WordPress , , ,

  1. December 24th, 2009 at 00:24 | #1

    it gives me this messege: Unknow registration response

  2. December 24th, 2009 at 02:15 | #2

    fixed by removing registration anti-spam check for simple forum.

  3. February 2nd, 2010 at 19:07 | #3

    I’m using this code (which is great), but I set it up so that you can register within the thickbox, too. However, when a user registers, they are taken away from the page they were on and set to the wp-login.php. Any suggestions on how I can get them sent back to the same page they were just viewing and then be prompted by the thickbox to login.

    Any ideas?

    http://www.bouncingbackfromloss.com/bbfl/blog/

    Visiting the page will automatically trigger the thickbox if you’re not logged in.

  4. February 8th, 2010 at 13:31 | #4

    @deadnick
    Is there a function I can call to use this instead of having it in the sidebar as a widget?

    Looks like just what I need, but I’m not using sidebars. Need it inthe header

  5. February 9th, 2010 at 11:24 | #5

    The plug in worked great until I upgraded to WP 2.9.1. Now there are issues:

    1. When I click “log out”, instead of reloading whatever page I’m on or redirecting me back to the blog home page, it sends me to a 404 page not found error page. This is duplicated no matter which account I log in under.

    Log out from the admin functions normally – it’s just logging out through the plugin that is an issue.

    2. Attempts to register new accounts are met with a pop up error message: “Unknown Registration Response”. Registration was attempted with 2 made up user names with 2 different email accounts. Both resulted in the same error message and no registration email is sent.

    3. Lost Password/Reset Password remains functional. No issue there.

    Can you assist with a fix?

  6. Wavatar
    David Heffernan
    February 20th, 2010 at 06:36 | #6

    I think there’s a bug in the code which builds the log out link.

    It says:

    wp_logout_url(‘/wp-login.php

    If you blog doesn’t live at the root of the domain then this link doesn’t work. For example if your blog is at http://example.com/blog/ then it will fail.

    I think the simple fix is for the above code to say:

    wp_logout_url(‘wp-login.php

    Thanks a lot for the excellent plug-in!!

  7. February 25th, 2010 at 10:15 | #7

    Hey David,

    Thanks for the tip – I’ll give that a try and see if it resolves the issue and report back. Although in my situation, the log out functionality has worked just fine until I upgraded to WP 2.9.1, even though my blog has never lived at the root of the domain.

    I LOVE this plugin and really want it to work.

  8. February 25th, 2010 at 10:37 | #8

    Hi David,

    I don’t have that line of code in any of my plug in files. Anyway, since registration has also been affected, I really think something in the new version of WP broke the plugin, rather than the plug in having a bug in the code – because as mentioned earlier…this worked fine for me until I upgraded to the new WP version (at the time 2.9.1 and more recently 2.9.2) even though my blog has never been on the domain root.

    Thanks for your help though. Hopefully Mr. Underhill will take a look at it soon and post a fix.

  9. March 4th, 2010 at 03:11 | #9

    Hi David,
    I am getting a “Stack overflow error at line: 10″ error message in a dialog window when your plug-in is activated. It does not matter if I use the widget or not. I have disabled all other plugins for testing but I get the same error. I use IE8. In Chrome I don’t get a message but registration or login does not work in either of them.

    When I change the theme to the default, things work somewhat, but when loggin out I get a 404…sigh

    Here is an error report from IE
    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
    Timestamp: Thu, 4 Mar 2010 11:01:52 UTC

    Message: ‘alw_registerForm.user_login’ is null or not an object
    Line: 62
    Char: 2
    Code: 0
    URI: …/wordpress/wp-content/plugins/ajax-login-widget/ajax_login_widget.js

    Message: ‘alw_loginForm.log’ is null or not an object
    Line: 40
    Char: 2
    Code: 0
    URI: …d/wordpress/wp-content/plugins/ajax-login-widget/ajax_login_widget.js

    Any idea?

    Cheers
    Meini

  10. Wavatar
    jon73
    March 4th, 2010 at 16:46 | #10

    hi

    Please take a look a http://www.affinitiworx.com your login widget is being used in the top right of the masthead. For some reason when a login is attempted a pop appears stating “unknown login response”. Now the user does get logged in but unless they click on a menu link they wouldn’t know it. I looked at your FAQ on the WordPress plugin page but I don’t have a start.php file in my themes and I am not sure exactly which ‘…’ tags you are refering to.

    I would appriciate a response as soon as possible, preferably to my email, which you now have on file.

    Many thanks
    Jon

  11. Wavatar
    jon73
    March 4th, 2010 at 17:09 | #11

    PS: I removed the captcha code requirement from the 2 contact forms on the site and still didn’t work. I noticed from other posts that an anti spam method may be the reason.

  12. Wavatar
    ramil
    March 8th, 2010 at 11:42 | #12

    Hi! What’s about CAPTCHA? (ex. re-captcha)

  13. Wavatar
    luca
    March 26th, 2010 at 03:21 | #13

    Hi David,

    i like the plugin , but the validation form’s alert most of the time is empty, without any messages

    how can i fix it , i have already added few condition in ajax_login_widget.js , but i’m still getting the empty alert,sample when the user already exist in the db or username and pwd are wrong ect…

    any help will be really appreciated. Thanks

  14. April 20th, 2010 at 07:55 | #14

    I really love this plugin but i have an issue that is bothering me alot. When people registrate, it says: Please check your email for your password. But my subscribers never gets an email? How can i fix this? Thank you for your response.

  15. Wavatar
    javy
    April 26th, 2010 at 12:53 | #15

    Hi David,

    Love the plugin. Question – I need to collect user info when they register, what’s the best way to do this with your plugin? Can I change the code so when they click Register it redirects them to the standard WP login page?

    Thanks!
    javy

  16. Wavatar
    Thien Dung
    May 3rd, 2010 at 23:06 | #16

    Hi David,

    When I login, I get “Unknown login response”. Please help me to fix this bug.

  17. Wavatar
    justin
    May 14th, 2010 at 20:10 | #17

    hello, love the plug-in…trying to add it to a wordpress page…tried to add it in the html tab as a code? could you help with this…i also currently have it in my sidebar, can you run 2 instances of it on the same page?

  18. May 16th, 2010 at 23:59 | #18

    I implemented this login/register plugin but am wondering why the login fields are uneven. I am currently using the latest version of WP and when I installed the plugin, WP said that this plugin has not been tested on the version of WP that I am using. Also is there a way to write the code into a sidebar instead of a widget?

  19. Wavatar
    vicky
    May 26th, 2010 at 09:05 | #19

    Thanks , its a good login widget. But i got some problems with it.
    Its not working fine with internet explorer . Its creating problems with desgin issues. Its working fine with firefox. how can i make it work fine with IE versions.

    Hope to hear something back.

  20. June 5th, 2010 at 03:34 | #20

    Hey everybody,

    Here is a good fix for anybody having a problem with the log out url giving that “WordPress Failure Notice” page…

    In this file:
    ajax-login-widget/alw_template.php

    Fix the log out url line to this line here:
    (<a href="”>log out)

    This is set to redirect them to the sites homepage, but you could easily substitute whatever dynamic or hardcoded url in there…

    Josh

  21. July 12th, 2010 at 09:37 | #21

    sir i used AJAX Login Widget++, it was work properly last 5 months but now registration is not working properly so please suggest me if it was work what is possibility of create a problem i did not change any code..
    http://gogos.clients.intdev.co.za/

  22. Wavatar
    Mo
    August 4th, 2010 at 06:43 | #22

    Hi,

    Why the logout process always redirect us to the wp logon page?
    Is there any way to go back to the home page after the logout action ?

    Thanks

  23. September 2nd, 2010 at 13:11 | #23

    Hi David,

    I’m very new to this. Your readme file says the widget is easily customizable with CSS. There are no CSS files in you widget; is there a list of elements somewhere that I can refer to to style AJAX Login ++?

    Whatever help you can provide would be greatly appreciated ==

    ransomcat

  24. Wavatar
    Mike
    November 26th, 2010 at 08:34 | #24

    Is this plugin still alive?

    I’ve been fiddling with this plugin and I think the logout problem is a bug. The intent was to redirect to the referring page, but it creates a malformed URL. Also the reason why you don’t get the right CSS styling is it doesn’t call the standard $before_widget, $after_widget stuff. I have fixes for both, and also a more table-like template file.

    Are you accepting patches?

    Mike

  25. December 4th, 2010 at 18:59 | #25

    Hi David,
    This plugin/widget works wonderful for me.
    I have three customizable areas where I need to use the widget. Unfortunately it seems I can only use one instance.
    Do you have any guidance on how I can use it in all three areas?
    Regards
    Cor

  26. December 11th, 2010 at 07:06 | #26

    Great plugin

    Thanks alot!

  27. February 3rd, 2011 at 16:00 | #27

    Hi, love this little plugin, I have it working on my site http://www.mark-sunter.com I’ve re-syled it into a one line form and put it in a nice slide down box. I also fixed the bug for log out redirect. I was just wondering if you know of any way for this plugin to work with “Peters login redirect” found here http://www.theblog.ca/wplogin-redirect you might know a quick fix that I dont :) best regards, Mark

  28. February 15th, 2011 at 04:32 | #28

    @Mark Sunter
    Cool. Would you mind sharing the patch for the bug you fixed?

  29. February 22nd, 2011 at 04:32 | #29

    Great plugin

    Thanks alot!

Comment pages
  1. No trackbacks yet.