API create_user.php - WKuehnTP/wdk-test GitHub Wiki
Create a User (/api/create_user.php) **UserFrosting
- Method:
- $POST
- Required Variables:
- $user_name, $display_name, $email, $title, $phone, $password, $passwordc
- Optional Variables:
- $comp_name, $comp_type, $comp_site, $referral, $tokenstr, $order, $admin, $add_groups, $skip_activation, $primary_group_id, $captcha, $spiderbro, $csrf_token
- Description:
- If an Admin is creating a user there must be a logged in user
- Check if Cross-Site Request Forgery (CSRF) is valid
Otherwise
- Check if Master Account is set and registration is enabled
- check that the user is not currently logged in
- Load the user creation variables
- If this registration is coming from an invitation or enrollment
- Check if hash relates to a specific invite.
- Store the invite’s Organization’s ID, their permission level for the organization, and the
- invite’s ID , flag as invite
- If this registration is coming from an order
- Flag as an enrollment order
- IIf we're in admin mode, require title. Otherwise, use the default title
- Check for missing required variables, If any missing, store the number of errors and create alerts
- If we’re not in Admin mode check spiderbro Honeypot for possible spam
- If no errors and Admin is creating a user and skip_activation is true, or if it’s an invite ,
- or if it’s an enrollment order, Do not require an activation email
- If Admin is not creating the user use the global setting on whether or not an activation email is required.
- execute /models/secure_functions.php:createUser() to create new user
- Create organization, CRM organization, sender profile
- Send notification of Account creation
Otherwise…