Contents
On this page

Revert Activity Entry - Plugixa Advanced User Role Editor

POST /plugixa-aure/v1/activity/{id}/revert

Undo one logged change, when nothing has changed the same thing since.

Needs the Edit roles permission: plugixa_aure_edit_roles. Needs Plugixa Advanced User Role Editor Pro with the Activity log feature switched on in Settings: otherwise the route is not registered and answers 404.

Request

POST https://your-site.example/wp-json/plugixa-aure/v1/activity/318/revert

Path parameters

Name Type Description
id integer The entry’s id

Only role.capabilities, user.roles, user.capabilities, menu.rules and cleanup.rules entries can be undone on their own, and only while the thing they changed is still exactly as the entry left it. For anything else, restore a point with Restore From History. The undo goes through the same guardrails as any change, takes a restore point first, and is logged with the source revert.

Responses

200 OK. The change was undone.

{
  "success": true,
  "data": {
    "reverted": 318,
    "snapshot": 45
  }
}
Field Type Meaning
data.reverted integer The entry undone
data.snapshot integer The restore point taken before the undo. 0 for rule entries, which take none

Errors

Status Code When
404 plugixa_aure_not_found No entry with that id.
409 plugixa_aure_already_reverted The entry was already undone.
422 plugixa_aure_not_revertible This kind of change cannot be undone on its own.
409 plugixa_aure_changed_since The role or account changed again since, or no longer exists.
403 plugixa_aure_user_not_editable The account holds a role with capabilities you do not hold yourself.
403 plugixa_aure_cannot_grant The change grants, or lifts a block on, a capability you do not hold yourself.
403 plugixa_aure_cannot_revoke The change takes away, or blocks, a capability you do not hold yourself.
409 plugixa_aure_last_administrator The account is the only administrator and would lose the role (single site only).
409 plugixa_aure_self_lockout The change would remove your own access to the editor.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-aure/v1/activity/318/revert" \
  -u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-aure/v1/activity/318/revert');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-aure/v1/activity/318/revert', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
  },
});
const { data } = await response.json();

Quick Links

Share