Note: This is part of the developer docs and is considered custom code.
Unfortunately, we cannot provide support for custom code at this time as we do not have the additional resources that would be necessary to provide support for custom code.
If you need assistance with this, please reach out to our list of consultants for further assistance:
Create a new customer record.
- $user_id (int) - ID of the corresponding user account. This is required if $user_args (below) is not specified.
- $user_args (array) - Instead of specifying a user ID (above) you can set an array of arguments used in the wp_insert_user() function to automatically create a new user account. This is required if $user_id (above) is not specified. Arguments include:
- $user_login (string) - The user's login username.
- $user_email (string) - The user's email address.
- $user_pass (string) - The plan-text user password.
- $first_name (string) - The user's first name.
- $last_name (string) - The user's last name.
- $date_registered (string) - Optional. Date this customer registered in MySQL format. Defaults to current time.
- $email_verification (string) - Optional. Email verification status. Accepts: none, pending, or verified. Default none.
- $last_login (string) - Optional. Date the user last logged into their user account in MySQL format.
- $ips (array) - Optional. Array of known IP addresses for this customer.
- (int|false) - ID of the newly created customer on success, or false on failure.
Create a new customer record with an existing user ID.
$customer_id = rcp_add_customer( array( 'user_id' => 12, 'date_registered' => '2019-01-01 12:00:00' ) );
Create a new customer record and a new user account simultaneously. This customer is pending email verification.
$customer_id = rcp_add_customer( array( 'user_args' => array( 'user_login' => 'username', 'user_email' => 'firstname.lastname@example.org', 'user_pass' => wp_generate_password( 24 ), 'first_name' => 'Bob', 'last_name' => 'Smith', ), 'email_verification' => 'pending' ) );