The MU forums have moved to WordPress.org

AJAX Hack - Check user and blog (31 posts)

  1. ssbansal
    Member
    Posted 17 years ago #

    I have slightly edited and added code to add ajax capabilities into the wordpress mu signup.

    It simply just checks if the current username is available or if it is not then it will give you alternatives.

    The same with the blog address.

    Currently works with directory url not subdomains

    If anyone is interested i will post the link to the file.

    Just reply back to tell me

  2. Iron
    Member
    Posted 17 years ago #

    Are you kidding? :-)

    We are always interested!

  3. ssbansal
    Member
    Posted 17 years ago #

    As you want.

    http://www.bansal-inc.com/ajaxhack

    This will help you out on the 2 simple instructions.

    Please Note: This will only work on a vanilla wp-signup.php.

    Enjoy the hack.

  4. ssbansal
    Member
    Posted 17 years ago #

    User feedback would be nice so I know what to add in the next version.

    Whats Planned -

    - To add a tick image inside the text box if the field entry is available.

    - If it is not available will show a cross in the text field.

    Any other info and probably to know the websites that are using it would be nice to see.

  5. lunabyte
    Member
    Posted 17 years ago #

    You do know that there isn't a need for a "hack", right? The hooks available in the sign-up form would easily accommodate this.

  6. ssbansal
    Member
    Posted 17 years ago #

    No code was changed only added, i will set out a little tutorial on how to do this with wordpress

  7. lunabyte
    Member
    Posted 17 years ago #

    I don't think you got what I was saying.

    You could make it more compatible with existing set-ups if you wrote it as a plugin, and took advantage of the hooks in wp-signup.php.

    Meaning, no need to do a file replace, or add any code to the actual signup page.

  8. ssbansal
    Member
    Posted 17 years ago #

    That's the part im not good with, I haven't really used wordpress coding before. Ive made a plugin before but what type of things would i need in order to give the plugin to have the same functionality?

  9. qza
    Member
    Posted 17 years ago #

    When I enter 3 letter username in the signup form, it says that username is available. But wpmu user has to have at least 4 letters.

  10. ssbansal
    Member
    Posted 17 years ago #

    Oh ill have to fix that along with the check username on a blank field.

    Thanks for the tip.

    What was your view on the hack though ?

  11. qza
    Member
    Posted 17 years ago #

    If you integrate above, I'll use it right away. Thank you for the hack :)

  12. ssbansal
    Member
    Posted 17 years ago #

    Would anyone have an idea on how to do this?
    Ive been looking for a way but is anyone able to know what code fix to add?

  13. ssbansal
    Member
    Posted 17 years ago #

    What you've been waiting for the new release :D

    With all the bug fixes.
    Read the HTML File in the package: HELP US.html

    http://www.bansal-inc.com/ajaxhack


    CHANGELOG

    #-- Version 1.5.0

    - Added the request to check if the username is over 4 characters.
    - Fixed the problem with the username / Blog Name allowing a blank field
    - Updated Sajax to Version 0.12

    #-- Version 1.0.0

    First Initial Release

  14. ssbansal
    Member
    Posted 17 years ago #

    Any feedback on the new version ??

  15. Iron
    Member
    Posted 17 years ago #

    I'll try to get it as a plugin this weekend.

  16. ssbansal
    Member
    Posted 17 years ago #

    Ive been trying to get this fixed to a plugin but i can't find the hook name to add the results div's or adding onblur/onchange functions to inputs.

    else i can turn this into a plugin straight away.

  17. Iron
    Member
    Posted 17 years ago #

    Take a look here, at the final solution :
    http://buddypress.com/code/replacing-the-dashboard/

  18. suleiman
    Member
    Posted 17 years ago #

    Iron, that doesn't really have much of anything to do with this plugin does it? correct me if i'm wrong please.

  19. lunabyte
    Member
    Posted 17 years ago #

    Doesn't look like it at all to me, either. So you're not alone in thinking that suleiman.

  20. ssbansal
    Member
    Posted 17 years ago #

    Stick with my hack, it's working fine and working perfect, and plus the next version will blow your mind away.

    http://bansal-inc.com/ajaxhack

  21. Ovidiu
    Member
    Posted 17 years ago #

    well, didn ot think much about Irons comment, but it was effective: I read very carefully twice through the page he linked to, just in case I was missing the link to this post..

    anyway, isntalled 1.5 and its working just fine for me, still a plugin would be most welcome instead of a hack ;-)

  22. ssbansal
    Member
    Posted 17 years ago #

    How would you apply a hook to an onlick function:

    e.g:

    <\a href="link"onclick="function"\>Text</\a>

  23. suleiman
    Member
    Posted 17 years ago #

    ssbansal, you write your entire code and enclose it within a function. Then you "hook" the function to the signup page via an "add action" command in your code.

    It would look something like this:

    add_action('signup_extra_fields', 'signup_ajax_check');

    function signup_ajax_check {
    code here....
    }

    does that make any sense?

  24. Iron
    Member
    Posted 17 years ago #

    I'm sorry,

    I wanted to point to how can we change a page content by plugging.

    I was thinking about applying css "table {display:none;}" and building a new custom signup form with a new <table class="ajaxreg"> and using "signup_hidden_fields" hook.

    I run this for user signup but it returns :

    Fatal error: Call to a member function get_error_message() on a non-object in D:\wamp\www\wp-content\mu-plugins\ajaxreg.php on line 311

    When I comment get_error_message conditionals, it show up and work correctly.

    3 am here, I'll try again tomorrow.

  25. Iron
    Member
    Posted 17 years ago #

    suleiman, sorry I haven't seen your response before posting. we need to modify the existent html, not just add a function. I tried to repleace all the form. I haven't got more time since last night to work on it.
    I just wanted to know if javascript can add onblur event to an input. That's possible since I can see it in action with this:

    var i;
    var inputs = document.getElementsByTagName("input");
    for(i=0;i<inputs.length;i++) {
            inputs[i].onblur = colorize;
    
    }

    How to apply this to a specefic input ?

    I saw another interesting hook, but it will need a more complex code. Let's try with js first.

  26. ssbansal
    Member
    Posted 17 years ago #

    1:

    add_action('signup_extra_fields', 'signup_ajax_check');

    function signup_ajax_check {
    code here....
    }

    What type of code can be added in here??

    2:

    Where will the code show once activated??

    e.g. <input type="text" value="test">

  27. suleiman
    Member
    Posted 17 years ago #

    ssbansal, check the signupquestion plugin for more information.

    Link: http://wpmudevorg.wordpress.com/project/Signup-Security-Question

  28. ssbansal
    Member
    Posted 17 years ago #

    Thanks, if i get the right stuff then a plugin will be made in no time :)

  29. suleiman
    Member
    Posted 17 years ago #

    glad to be of help ss :)

  30. Mattz
    Member
    Posted 17 years ago #

    Is the zip file not available for download anymore ?

    Or is the new version out ?

About this Topic

  • Started 17 years ago by ssbansal
  • Latest reply from MrBrian