Add Account Number

Discussion in 'Integration' started by rmara, Jul 17, 2017.

  1. rmara

    rmara Eager Beaver and Avid Learner

    Jan 21, 2013
    Has anyone created an account number for a new user during the sign up process? Added a field to the user table and like to update it with a generated account number at the time a new user signs up for service. I am digging around, just not sure where the code should be placed. Create a new signup page and add the code there?

    You help is greatly appreciated.

  2. caesar

    caesar aMember Pro Developer Staff Member

    Oct 16, 2009
    Hello Roy,

    1. First of all you need to add new SQL field to user profile. You can do it from admin interface at
    aMember CP -> Configuration -> Setup/Configuration -> Add User Fields

    2. Then you can use the following code in site.php to generate this number:

    I assume you call this field 'idnum':
    Am_Di::getInstance()->hook->add(Am_Event::USER_BEFORE_INSERT, function(Am_Event $e) {
    $e->getUser()->idnum uniqid();
    3. You can add this field to user profile form and within configuration of these field make it readonly:
    aMember CP -> Configuration -> Forms Editor

    4. Also you can use Widget plugin (free) and add this number to user dashboard. Within content of widget you can use
    user specific placeholders ie.:
    <p>Your Account Number: %user.idnum%</p>


    I hope it helps.

    Best Regards

Share This Page