These abilities create members and manage access passes. They write data, so they carry stricter capability requirements than the read-only lookups. See the Abilities API Overview for the full permission model.
create-member
members-only/create-member creates a new WordPress user account with a securely generated password. The account is not a member by itself — membership comes from an active subscription, an access pass, or a group membership. Pass access_pass_days and/or group_id to make the new user a member in the same step, or omit both to create a bare account (for example, so the user can purchase a subscription themselves). The ability can also set a display name and email the new user their account details. The new user is never signed in by this ability.
Who can run it: users with the create_users capability. Granting an access pass at creation additionally requires edit_users; adding the new user to a group additionally requires manage_options.
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | Yes | The new member’s email address. Also used as the username. |
name | string | No | Display name for the new member |
send_notification | boolean | No | Whether to email the new user their account details. Defaults to false. |
access_pass_days | integer | No | Number of days to grant an access pass for, starting immediately |
group_id | integer | No | Group to add the new user to upon creation, making them a member immediately. Requires the Group Memberships extension and consumes a seat in the group. |
Returns: the new user_id and email, plus access_pass_granted, group_added, and notification_sent flags. If the account was created but the group add then failed, group_added is false and a group_error message explains why.
Errors: members_only_invalid_email for a malformed address, members_only_email_exists when a user with that email or username already exists, and members_only_access_pass_permission_required when access_pass_days is set but the invoking user lacks edit_users. When group_id is set: members_only_groups_unavailable if the Group Memberships extension is not active, members_only_manage_members_permission_required if the invoking user may not add group members, members_only_group_not_found for an unknown group, and members_only_no_seats_available when the group is full. Group checks run before the account is created, so a failed check never leaves behind a half-created user.
grant-access-pass
members-only/grant-access-pass grants a user a time-limited access pass — for example, a 30-day complimentary pass. It replaces any existing access pass on the user.
Who can run it: users with the edit_users capability.
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id / email | integer / string | One required | Identifies the user |
duration_days | integer | Yes | Number of days the pass is valid for (minimum 1) |
start_date | integer | No | Unix timestamp for when the pass begins. Defaults to now. |
Returns: user_id, granted, and the computed start_date and end_date timestamps.
Errors: members_only_invalid_duration when duration_days is not a positive integer, and members_only_grant_failed if the pass could not be saved.
revoke-access-pass
members-only/revoke-access-pass removes a user’s access pass. It succeeds whether or not the user currently has a pass, so it is safe to call repeatedly.
Who can run it: users with the edit_users capability.
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id / email | integer / string | One required | Identifies the user |
Returns: user_id and revoked.
This is a destructive operation: once revoked, the user immediately loses any access the pass was providing.
