Skip to:
Content
Pages
Categories
Search
Top
Bottom

Email Login + Random Member URLs

Viewing 9 replies - 1 through 9 (of 9 total)

  • peterverkooijen
    Participant

    @peterverkooijen

    Email login plugin. Lose the username field by making it type=”hidden” on register.php and autogenerating a username value using a trick like this one.


    Nick Watson
    Participant

    @nickbwatson

    Sounds perfect! Thanks a lot.

    And how come every time I searched email login I couldn’t find it, but now out of the blue it’s there!

    Thanks a lot!

    I won’t close it yet until I see if the trick works.

    I can’t see why it wouldn’t.


    Nick Watson
    Participant

    @nickbwatson

    It works excellent! And no function was needed to be created.

    In the header I just put in the javascript:

    <script type = "text/javascript">
    function copyinput(){
    var tmp = document.getElementById('signup_email').value;
    tmp = tmp.toLowerCase().replace(/^s+|s+$/g, "").replace(/[_|s]+/g, "");
    tmp = tmp.replace(/[^a-z0-9-]+/g, "").replace(/[-]+/g, "-").replace(/^-+|-+$/g, "");
    document.getElementById('signup_username').value = tmp;
    }
    </script>

    And then within the register.php file I put:

    onkeyup=”copyinput()” within:

    <input type="text" name="signup_email" id="signup_email" value="<?php bp_signup_email_value() ?>" onkeyup="copyinput()" />

    However, obviously with the code I have currently all it’s doing is stealing the email and plugging it into the username slot without the “@” symbol and the “.”

    So how can I randomize it so that it’s not necisarily the email, but just some random number? (but I’d have to ensure that there would be no duplicates, otherwise it wouldn’t work)

    Thanks


    Nick Watson
    Participant

    @nickbwatson

    ooookay, progress progress and it will work, but is there a more efficient way to do this?

    tmp = tmp.replace(/[a]+/g,"1").replace(/+/g,"2").replace(/[c]+/g,"3")... etc...

    So basically what I’m doing is I’m replacing every letter with a corresponding number.

    It works perfectly because when you think about it, no one can sign up with the same email, and if the ‘username’ is taken from the email then it’s perfect!


    Nick Watson
    Participant

    @nickbwatson

    Excellent, I’ve got it working in a way that I like.

    I’ll post a link here when I upload the code for anyone else that would like to use Email drivin logins.


    Nick Watson
    Participant

    @nickbwatson

    bah, problem occurred. Usernames must contain a letter.. I’m workin on it.


    Nick Watson
    Participant

    @nickbwatson


    Mike Pratt
    Participant

    @mikepratt

    It’s a concept I am considering but one question: What becomes of the existing users who already have reg usernames and reg urls for their profiles? Does their account email become their login?


    Nick Watson
    Participant

    @nickbwatson

    With the email login plugin, yes it becomes their login, however because they have already been created, their urls will still be their username, and they can still log in with their usernames.

    So they can log in with both email and their old username.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Email Login + Random Member URLs’ is closed to new replies.
Skip to toolbar