How to create a new user using $$addUser

This is a short explanation on how to create new users using the SITEFORUM user function $$addUser .
$$addUser awaits an array of user information to create the new user. Available fields are:

Field name Description Allowed characters Mandatory field
CUSTOMERID Specifies the user ID. Usually this gets generated via $\$getTime{unique}. Numbers only MANDATORY
LASTNAME Specifies the last name. Any characters MANDATORY
FIRSTNAME Specifies the first name. Any characters MANDATORY
COMPANY Specifies the name of the company. Any characters
DEPARTMENT Specifies the name of the company's department. Any characters
STREET Specifies the street (address). Any characters
STREET2 Specifies the additional address information. Any characters
ZIP Specifies the zip. Any characters
CITY Specifies the name of the city. Any characters
STATE Specifies the state. Any characters
COUNTRY Specifies the name of the country. Any characters
POSTBOX Specifies the postbox. Any characters
PHONE_MOBILE Specifies the mobile phone. Any characters
PHONE_ADDITIONAL Specifies the additional phone. Any characters
FAX Specifies the fax. Any characters
PHONE_PRIVATE Specifies the private phone. Any characters
PHONE_WORK Specifies the work / business phone. Any characters
EMAIL Specifies the email address. Any characters
WEBSITE Specifies the user's website URL. Any characters
LOGINNAME Specifies the loginname (user name) of the user. This must be a unique name. Any characters; must be unique MANDATORY
PASSWORD2 Password string. Will be encrypted with 3DES encryption. Any characters MANDATORY (if not supplied, a password will be auto-generated)
TITLE Specifies the title of the user Any characters
PRIORITY Specifies the priority of the user (High, Normal, Low) Any characters
CUST_DETAILS Specifies details / description Any characters
BIRTHDAY Specifies the birthday of the user Numbers only , positive or negative timestamp in milliseconds required
SALUTATION Specifies the salutation Any characters
ASSISTANT Specifies the name of the user's assistant Any characters
ASSISTANT_PHONE Specifies the phone number of the user's assistant Any characters
PWDSTATUS Specifies the password status of the user. Several password status are available:

  • 1... Password expires as set the in the portal preferences (i.e. after 30 days)
  • 2 ... Expires soon (reminder email already sent)
  • 3 ... Password expired - access locked
  • 4 ... Password does not expire (Default)
  • 5 ... Access locked. Wrong password entered 3 times!
  • 6 ... Expires on specified date (set by Administrator)
  • 7 ... Account not activated yet
  • 21 ... Password does not expire ; user must change password on first login
  • 37 ... Password does not expire ; user must change / save profile on first login
  • 53 ... Password does not expire ; user must change / save profile and password on first login
  • Only numbers Default value is 4
    LID Specifies the preferred language of the user:
    0 ... english
    1 ... deutsch
    2 ... francais
    3 ... spain
    0 | 1 | 2 | 3 | ...
    CALLINGNAME Specifies the user's calling name Any characters
    TIMEZONE Specifies the user's timezone. Must be a valid timezone ID from the portal's timezone database Valid timezone ID , i.e. 1 is USA (Pacific Time) (GMT -08:00)
    SHIP_STREET Specifies the street of the users shipping address Any characters
    SHIP_CITY Specifies the city of the users shipping address Any characters
    SHIP_STATE Specifies the state of the users shipping address Any characters
    SHIP_ZIP Specifies the zip of the users shipping address Any characters
    SHIP_COUNTRY Specifies the country of the users shipping address Any characters
    INTERNAL2 Specifies whether the user is an internal user (of the company) or an external contact 1 ... internal | 0 ... external Default value is 0
    NOLOGIN Specifies whether the user may login to the portal or not 1 ... may not login | 0 ... may login 0
    NOEMAILS Specifies whether the user receives system emails from the portal or not 1 ... receives no emails | 0 ... receives emails
    VAR0 Specifies the value of the variable field "VAR0" Any characters
    VAR1 Specifies the value of the variable field "VAR1" Any characters
    VAR2 Specifies the value of the variable field "VAR2" Any characters
    VAR3 Specifies the value of the variable field "VAR3" Any characters
    VAR4 Specifies the value of the variable field "VAR4" Any characters
    VAR5 Specifies the value of the variable field "VAR5" Any characters
    VAR6 Specifies the value of the variable field "VAR6" Any characters
    VAR7 Specifies the value of the variable field "VAR7" Any characters
    VAR8 Specifies the value of the variable field "VAR8" Any characters
    VAR9 Specifies the value of the variable field "VAR9" Any characters
    VAR10 Specifies the value of the variable field "VAR10" Any characters
    SECURITY_QUESTION Specifies the security question Any characters
    SECURITY_ANSWER Specifies the security answer Any characters
    LEVEL2 Specifies the level of the user Numbers only (0,1,2 ... 10)
    Code example:

    $// collect all values and write to an array
    $set{user(CUSTOMERID)}{$getCurrent{userID}}
    $set{user(LASTNAME)}{$getCurrent{LASTNAME}}
    $set{user(FIRSTNAME)}{$getCurrent{FIRSTNAME}}
    $set{user(COMPANY)}{$getCurrent{COMPANY}}
    $set{user(DEPARTMENT)}{$getCurrent{DEPARTMENT}{-}}
    $set{user(CITY)}{$getCurrent{CITY}}
    $set{user(COUNTRY)}{$getCurrent{COUNTRY}}
    $set{user(STREET)}{$getCurrent{STREET}{-}}
    $set{user(ZIP)}{$getCurrent{ZIP}{-}}
    $set{user(POSTBOX)}{$getCurrent{POSTBOX}{-}}
    $set{user(PHONE_MOBILE)}{$getCurrent{PHONE_MOBILE}{-}}
    $set{user(PHONE_ADDITIONAL)}{$getCurrent{PHONE_ADDITIONAL}{-}}
    $set{user(FAX)}{$getCurrent{FAX}{-}}
    $set{user(EMAIL)}{$getCurrent{EMAIL}}
    $set{user(WEBSITE)}{$getCurrent{WEBSITE}{-}}
    $set{user(STATE)}{$getCurrent{STATE}}
    $set{user(STREET2)}{$getCurrent{STREET2}{-}}
    $set{user(LOGINNAME)}{$getCurrent{LOGINNAME}}
    $set{user(PASSWORD2)}{$getCurrent{PASSWORD2}}
    $set{user(TITLE)}{$getCurrent{TITLE}}
    $set{user(PRIORITY)}{Normal}
    $set{user(CUST_DETAILS)}{$getCurrent{CUST_DETAILS}}
    $set{user(BIRTHDAY)}{$get{BIRTHDAY_milli}{0}}
    $set{user(SALUTATION)}{$getCurrent{SALUTATION}{}}
    $set{user(ASSISTANT_PHONE)}{$getCurrent{ASSISTANT_PHONE}}
    $set{user(ASSISTANT)}{$getCurrent{ASSISTANT}}
    $set{user(PWDSTATUS)}{$get{PWDSTATUS}{4}}
    $set{user(PWDEXPIRATION)}{$toInteger{$add{$time{}}{$getProperty{pwd_expiration}{-1}}}}
    $set{user(LID)}{$getCurrent{LID}{0}}
    $set{user(CALLINGNAME)}{$getCurrent{CALLINGNAME}{}}
    $set{user(TIME_ZONE)}{$getCurrent{TIME_ZONE}{1}}
    $set{user(SHIP_STREET)}{$getCurrent{SHIP_STREET}{}}
    $set{user(SHIP_CITY)}{$getCurrent{SHIP_CITY}{}}
    $set{user(SHIP_STATE)}{$getCurrent{SHIP_STATE}{}}
    $set{user(SHIP_ZIP)}{$getCurrent{SHIP_ZIP}{}}
    $set{user(SHIP_COUNTRY)}{$getCurrent{SHIP_COUNTRY}{}}
    $set{user(INTERNAL2)}{$getCurrent{INTERNAL2}{0}}
    $set{user(NOLOGIN)}{$getCurrent{NOLOGIN}{1}}
    $set{user(NOEMAILS)}{$getCurrent{NOEMAILS}{1}}
    $set{user(VAR1)}{$getCurrent{VAR1}{}}
    $set{user(VAR2)}{$getCurrent{VAR2}{}}
    $set{user(VAR3)}{$getCurrent{VAR3}{}}
    $set{user(VAR4)}{$getCurrent{VAR4}{}}
    $set{user(VAR5)}{$getCurrent{VAR5}{}}
    $set{user(VAR6)}{$getCurrent{VAR6}{}}
    $set{user(VAR7)}{$getCurrent{VAR7}{}}
    $set{user(VAR8)}{$getCurrent{VAR8}{}}
    $set{user(VAR9)}{$getCurrent{VAR9}{}}
    $set{user(VAR10)}{$getCurrent{VAR10}{}}
    $set{user(SECURITY_QUESTION)}{$getCurrent{SECURITY_QUESTION}{}}
    $set{user(SECURITY_ANSWER)}{$getCurrent{SECURITY_ANSWER}{}}
    $set{user(PHONE_PRIVATE)}{-}
    $set{user(PHONE_WORK)}{-}
    $set{user(LEVEL2)}{0}

    $// call addUser with the user array and save return value to local variable
    $set{create_user}{$$addUser{$get{user}}}

    Most of the fields are not mandatory. So, this code will also create the user:
    $set{user(CUSTOMERID)}{123456789}
    $set{user(FIRSTNAME)}{Jane}
    $set{user(LASTNAME)}{Smith}
    $set{user(LOGINNAME)}{j.smith}
    $set{user(EMAIL)}{jane[at]siteforum.com}

    $$addUser{$get{user}}


    How to create a new user using $$addUser
    SITEFORUM Portal Software : Web Applications To Smart Up Your Business | Enterprise Content Management Software | Shortcuts | Portalsoftware