ft_api_create_client_account

This function creates a client account programmatically. Example usage:

<?php
$account_info = array(
  "first_name" => "Todd",
  "last_name" => "Atkins",
  "email" => "todd@gmail.com",
  "username" => "todd",
  "password" => "todd12345"
);
list($success, $info) = ft_api_create_client_account($account_info);
?>

The function takes a single parameter - an associative array (hash) with the following keys.

Required keys

  • first_name - the client's first name
  • last_name - the client's last name
  • email - the client's email address
  • username - the client's login username
  • password - the client's login password

Optional keys

  • account_status - "active", "disabled", "pending" (default: "pending")
  • ui_language - should only be one of the languages currently supported by the script, e.g. "en_us"
  • timezone_offset - +- an integer value
  • sessions_timeout - the inactivity duration after which the user is logged out (default: 30)
  • date_format - the formatting for the dates in the user's UI. Default: "M jS y, g:i A". See the PHP date() function for formatting options
  • login_page - the login page for the user (i.e. where they're redirected to after logging in). This value should be the key value from the $g_pages variable, found at the top of in the /global/code/menus.php file.
  • logout_url - where the client is sent when they log out
  • theme - the name of the theme folder
  • menu_id - the unique menu ID

Return Values

As with the other functions, if the $g_api_debug value is set to true in your api.php file, this function will display the error codes that occur. Otherwise, it returns the information. In that case, for either a successful or failed INSERT call, it returns an array with two indexes:

<?php
// ...
list($success, $info) = ft_api_create_client_account($account_info);

// if $success == true, $info contains the new account ID (an integer)
// if $success == false, $info contains an array of error codes
?>

The failure error codes are documented here.

Edit Page