Restrict Content Pro
rcp_get_customers
Coming soon: Restrict Content Pro is becoming Kadence Memberships. You may see both names used while we update the product, documentation, and customer experience.
Note: This content is provided as a resource within our developer documentation. Because custom code requires highly specific implementation, we encourage you to work with a qualified developer if you need guidance. You can find our recommended consultants here: https://codeable.io/developers/restrict-content-pro
Query for customers.
Parameters
$args (array) – Array of arguments, all of which are optional:
$id(int) – A customer ID to only return that customer. Default empty.$id__in(array) – An array of customer IDs. Default empty.$id__not_in(array) – An array of customer IDs to exclude from the results. Default empty.$user_id(int) – A user ID to filter by. Default empty.$user_id__in(array) – An array of user IDs. Default empty.$user_id__not_in(array) – An array of user IDs to exclude from the results. Default empty.$email_verification(string) – Filter by email verification status. Accepts:verified,pending, andnone. Default empty.$date_registered_query(array) – Date query clauses to limit customers by. See WP_Date_Query. Default empty.$last_login_query(array) – Date query clauses to limit customers by. See WP_Date_Query. Default empty.$count(bool) – Whether to return a customer count (true) or an array of customer objects (false). Default false.$fields(string) – Item fields to return. Accepts any known column name, or empty to return an array of complete customer objects. Default empty.$number(int) – Limit the number of results. Default 20.$offset(int) – Number of customers to offset. Default 0.$no_found_rows(bool) – Whether to disable theSQL_CALC_FOUND_ROWSquery. Default true.$orderby(string) – Acceptsid,date_registered, andlast_login. Also accepts false, an empty array, ornoneto disable theORDER BYclause. Defaultid.$order(string) – How to order results. AcceptsASCandDESC. DefaultDESC.$search(string) – Search term(s) to retrieve matching customers for. This searches most of the above customer columns. Default empty.$update_cache(bool) – Whether to prime the cache for found customers. Default false.
Return values
(array) An array of RCP_Customer objects.
Examples
Return customers that match any of the included user ID numbers:
$customers = rcp_get_customers( array(
'user_id__in' => array( 5, 73, 41, 104 )
) );
Return the customer ID numbers of all customers pending email verification:
$customer_ids = rcp_get_customers( array(
'email_verification' => 'pending',
'fields' => 'id'
) );