rcp_get_members_of_subscription()

rcp_get_members_of_subscription( $level_id = 1, $fields = 'ID' )

Used to retrieve all members for a given subscription level. This function does not take status into account, so it will return all active, expired, cancelled, and pending users as long as they're assigned to this subscription level.

Parameters:

  • $level_id (int) (optional) - ID of the subscription level to get members from. Default is 1.
  • $fields (string) (optional) - Which fields you'd like to include in the array that is returned. Options include:
    • ID - Return an array of user IDs. This is the default.
    • display_name - Return an array of user display names.
    • login - Return an array of user login names.
    • email - Return an array of user email addresses.
    • all - Return an array of WP_User objects.

Return values:

  • array - An array of user fields, depending on what you specified in the $fields parameter.