Skip to:
Content
Pages
Categories
Search
Top
Bottom

Email Login + Random Member URLs

  • Avatar of Nick Watson
    Nick Watson
    Participant

    @nickbwatson

    Hey, I’ve got 2 questions about the way users signup/register for buddypress websites.

    On the default sign up page, there are:

    Username

    Email

    Password

    Confirm Password

    Is there anyway that I can get rid of the Username field. Basically I want my users to log in with their emails, and not a username (like Facebook does it).

    And I know it might seem odd to some people that I would want my users to have a random profile url, but basically I want to leave the names free for users that I choose.

    I basically just want to leave the specific URLS free for users that I choose.

    So my 2 questions:

    1. Is there a way to create Email Login instead of Username Login

    2. How can I randomize the member URLS so they aren’t http://site.com/members/joe

    (I would prefer a URL like http://site.com/members/q23ks2lafd=2+)

    Thanks

    Nick

Viewing 9 replies - 1 through 9 (of 9 total)
  • Avatar of Peterverkooijen
    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.

    Avatar of Nick Watson
    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.

    Avatar of Nick Watson
    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

    Avatar of Nick Watson
    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!

    Avatar of Nick Watson
    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.

    Avatar of Nick Watson
    Nick Watson
    Participant

    @nickbwatson

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

    Avatar of Nick Watson
    Nick Watson
    Participant

    @nickbwatson

    Avatar of Mike Pratt
    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?

    Avatar of Nick Watson
    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.