UserEvents final readonly class
Minn\Runtime\UserEvents · public/minn/src/Minn/Runtime/UserEvents.php · 102 lines
What the reference's REST users controller tells plugins, for the engine's own: with plugins loaded an account is written through the runtime's wp_insert_user, wp_update_user and wp_delete_user (wp_set_password, each profile meta, the role, clean_user_cache, user_register and the count, profile_update, delete_user and deleted_user), and the REST actions follow. Without a booted runtime each write is the engine's own, given as a closure.
Public
| method | live(): bool# | Whether plugins are loaded to be told anything. | ||||||
| method | create(array $userdata, string $role, Minn\Http\Request $request, Closure $quietly): int# | Creates an account the way the REST controller does: wp_insert_user with no role, rest_insert_user, then the role added, then rest_after_insert_user. Returns the new id.
| ||||||
| method | update(int $id, array $userdata, ?string $role, Minn\Http\Request $request, Closure $quietly): void# | Updates an account: wp_update_user with the changed fields, the role when one is given, then the two REST actions.
| ||||||
| method | delete(int $id, ?int $reassign, array $data, Minn\Http\Request $request, Closure $quietly): void# | Deletes an account, its posts going to $reassign (or with it when none), then rest_delete_user with the account as it was.
|
Internals 1
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | prepared(array $userdata, WP_REST_Request $request): array# | rest_pre_insert_user over the prepared user (the request's fields), as the reference runs it before the save; what the filter changes is saved, an error refuses.
@return array<string, mixed> |
Nothing matches.