Skip to:
Content
Pages
Categories
Search
Top
Bottom

Email Login & Randomized User URLs – Solution

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

  • osasko
    Participant

    @osasko

    Awesome. Thanks!!


    peterverkooijen
    Participant

    @peterverkooijen

    Thanks for the mention nickbwatson. I did not write the code, it was assembled from several sources with help from BP developers.

    In my version I generated the username/user URL from the fullname, onkeyup on the form. I use the same javascript trick for blog name. I think there were some security objections to doing that, but it works for me for now.

    Someone earlier also posted a simpler php version that produces an entirely random string as value for username on a hidden input field. Can’t find that post…


    Nick Watson
    Participant

    @nickbwatson

    @osasko: Glad I could help

    @Peterversooijen: It’s really no problem, I wouldn’t have been able to do this at all with the code you provided. That’s what I like about buddypress, there’s no secrets, it’s just everyone helping everyone.

    I’m sure there are some better ways to do this, but like you said, it works for me for now.

    If I can find the other simpler php version I’ll post it here, or if anyone else does that’d be great.


    osasko
    Participant

    @osasko

    Hi, I think I’ve done everything correctly.

    On my register page – the username is removed , but when I say “complete sign-up” , the page just remains on the register page and no registering takes place.

    I used normal windows notepad to create the javascript file and saved it in my registration folder of my own theme.

    Don’t know?


    osasko
    Participant

    @osasko

    Would this still work with 1.2?

    Think maybe I am not getting it right because of BP 1.2?


    sweller
    Participant

    @sweller

    I was looking for the same solution and appreciate all the work you guys have done. However the javascript solution seems like a long way to generate a random string. Is there a reason not to use the mt_rand function or something similar? So to add “mem” the username form would look like:

    <input type="hidden" name="signup_username" id="signup_username" value="<?php echo("mem" . mt_rand()) ?>" />


    osasko
    Participant

    @osasko

    Sweller , bit confused now….

    Do you just have to replace the 3 lines that relate to “username” in your register.php , with the line you provide and not do anything else?


    sweller
    Participant

    @sweller

    Yeah, it seems to work fine by replacing the three lines of the username block with mt_rand. However be sure that there are letters somewhere in the value, such as the “mem” above. Buddypress will throw back an error without letters.

    Also this probably wouldn’t work with large websites with thousands of people, as the chance of generating the same username goes up. You’d probably have to write a function that generates a long string of random letters and numbers.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Email Login & Randomized User URLs – Solution’ is closed to new replies.
Skip to toolbar