ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Random ID on registration for username

April 29, 2013 11:15am

Subscribe [2]
  • #1 / Apr 29, 2013 11:15am

    David Rousseau

    39 posts

    Good morning everyone!

    OK, I’m building a subscription site where people register, and they do receive a discount card by mail.  They use that card to save in various businesses throughout the province.

    I’d like to give them a random card number, like “123 456 789”.  The idea is that they would then use this as their username in the future.  Since they can come back and login to access their profile, it would make sense.

    Should I go with using the username as the card number OR is there a way to assign a specific user_id to a member (without the system auto-incrementing it)?  This way I could generate a new random unique ID on registration and use it. And, is using numbers even possible for the username?

    In the backend (cpanel), having the user_id as the card number would be nice.  On the customer point of view, having the username as the card number would be ideal…

    What do you guys suggest ?

  • #2 / Apr 29, 2013 12:58pm

    Rob Allen

    3105 posts

    Hmm you could probably use a “random” plugin to generate a random string of letters/numbers and use that in a hidden field in your registration form - http://devot-ee.com/search/results?keywords=random&addon_version_support=ee2

    However, being random means there is always the possibility of duplicates…

  • #3 / Apr 29, 2013 1:32pm

    David Rousseau

    39 posts

    Thanks Rob

    Did a test in the meantime, and we can definitely use numbers as username.  Creating a php script to generate unique random id’s shouldn’t be a problem.

    But still, creating a custom user_id would be Great !  Any idea guys ?

  • #4 / May 08, 2013 10:18am

    David Rousseau

    39 posts

    OK, created a script that generate a unique random username (as length 9 integer), and it works well.

    It’s perfect for a registration page where I control what the user submit.

    However, I’d like to make it a plugin so that it runs automatically even for CP side registrations.

    Someone available to help?  I have budget if needed.

    Thanks

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases