MCP Abilities

Agents can read and set members’ numbers without wp-admin. Both number abilities take site_id, and a group admin (a team captain) can use them for their own group as well as anyone with bp_moderate. Changes made with set-group-number are recorded in LH Audit Trail when it is active.

Get Group Numbers

lh-buddypress-group-numbers/get-group-numbers Read-only Idempotent

Returns members' numbers per BuddyPress group, such as shirt numbers, by user or for a whole group, flagging duplicates. Pass user_ids for those users' numbers in every group (only in group_id when it is also given), or group_id alone to list every current member of that group with their number, null when they have none. Each number comes with its group's name and duplicate_user_ids, the other current members of that group holding the same number; duplicates sums these up per group and number. Numbers are read as the profile form reads them, so legacy lh-competitions numbers still show until the migration is finalised. Group mode lists confirmed members only, not invitees. Call set-group-number to change a number. Requires bp_moderate, or being an admin of group_id, which then limits the result to that group. Pass site_id to act on another site you belong to.

ParameterTypeRequiredDefaultDescription
user_idsarray of integerNoWordPress user IDs whose numbers to return.
group_idintegerNoBuddyPress group ID. Alone, lists every current member of the group; with user_ids, limits their numbers to this group.
site_idintegerNoOptional. ID of another site in the network to act on; list-my-sites gives the sites you belong to. Permissions are checked on that site. Omit for this site.
run_without_site_pluginsbooleanNoOptional, with site_id. Run the call through this connector even when that site has plugins of its own that cannot be loaded for it. Without this, such a write is refused if it cannot be run on that site itself.

Migrate Group Numbers

lh-buddypress-group-numbers/migrate-group-numbers Destructive Idempotent

Moves group numbers off lh-competitions' legacy keys: report (default) changes nothing and gives counts; migrate retypes every site's legacy xProfile fields and copies one batch of user meta to the new key, and is safe to repeat until users_to_copy is 0; finalise deletes the legacy user meta and ends the legacy fallback, and is refused while anything is left to move. Requires install_plugins; main site only.

ParameterTypeRequiredDefaultDescription
modestringNo"report"report (dry run), migrate (one batch) or finalise. One of: report, migrate, finalise.
batch_sizeintegerNo500Users to copy per migrate run.
task_idintegerNoOptional. The lh-tasks task this call is working on. Pass with claim_token: the call is refused unless you hold that claim, and a successful call renews it.
claim_tokenstringNoOptional. The claim_token from claim-next-task for task_id. Required when task_id is given.

Set Group Number

lh-buddypress-group-numbers/set-group-number Idempotent

Sets or clears one member's number in one BuddyPress group, such as a shirt number, and returns it before and after. Only that group's number changes; the member's numbers in other groups are kept, and the value goes through the plugin's own range and sanitising, as the profile form does. Pass number null to clear it. Refused when the user is not a member of the group, current or invited (as the profile form decides who gets an input), or when the number is out of range. When other current members of the group already hold the number it is still set, with a warning naming them in duplicate_user_ids. A change is recorded in LH Audit Trail, with note when given; setting the number a member already has changes nothing. Call get-group-numbers to check a whole group. Requires bp_moderate, or being an admin of the group. Pass site_id to act on another site you belong to.

ParameterTypeRequiredDefaultDescription
user_idintegerYesThe member's WordPress user ID.
group_idintegerYesThe BuddyPress group ID.
numberinteger|nullYesThe number, 0 to 999, or null to clear it.
notestringNoOptional. Why the number was set, recorded with the change in LH Audit Trail.
task_idintegerNoOptional. The lh-tasks task this call is working on. Pass with claim_token: the call is refused unless you hold that claim, and a successful call renews it.
claim_tokenstringNoOptional. The claim_token from claim-next-task for task_id. Required when task_id is given.
site_idintegerNoOptional. ID of another site in the network to act on; list-my-sites gives the sites you belong to. Permissions are checked on that site. Omit for this site.
run_without_site_pluginsbooleanNoOptional, with site_id. Run the call through this connector even when that site has plugins of its own that cannot be loaded for it. Without this, such a write is refused if it cannot be run on that site itself.