Skip to content

Trigger core actions when granting or revoking super admin permissions#20

Merged
schlessera merged 7 commits intowp-cli:masterfrom
felixarntz:master
Jan 5, 2022
Merged

Trigger core actions when granting or revoking super admin permissions#20
schlessera merged 7 commits intowp-cli:masterfrom
felixarntz:master

Conversation

@felixarntz
Copy link
Copy Markdown

When granting or revoking super admin permissions in WordPress, hooks are triggered which are missing in this implementation. By calling grant_super_admin() or revoke_super_admin() respectively, the following actions are triggered:

  • grant_super_admin (before changes, always executed)
  • granted_super_admin (after changes, executed only on success)
  • revoke_super_admin (before changes, always executed)
  • revoked_super_admin (after changes, executed only on success)

This PR adds the hooks so that plugin functionality integrating with these hooks still works correctly.

@schlessera
Copy link
Copy Markdown
Member

Logic seems not sound yet. Tests throw a notice on line 210 (https://github.com/wp-cli/super-admin-command/pull/20/files#diff-d6a2d26b46771bf2fec60753e981f488R210) because it wants to trigger a removed_xxx action on a non-existent login.

@schlessera schlessera added command:super-admin-remove Related to 'super-admin remove' command command:super-admin-add Related to 'super-admin add' command labels Feb 14, 2018
@felixarntz
Copy link
Copy Markdown
Author

I'll get back to this soon, to fix the issues.

@danielbachhuber
Copy link
Copy Markdown
Member

@felixarntz Still planning to pick this up?

@schlessera
Copy link
Copy Markdown
Member

@felixarntz Are you still up for this?

@felixarntz
Copy link
Copy Markdown
Author

@schlessera I don't have enough capabilities at the moment, but generally yes. I'll make a note to come back to it at some point the next month.

@schlessera
Copy link
Copy Markdown
Member

Just a gentle ping to see if you're still up for this, @felixarntz... :)

@felixarntz
Copy link
Copy Markdown
Author

@schlessera Thanks for reminding me. It's not a big one, but I'll need a bit more time to tackle this. Should be able to between Christmas and New Years. :)

@schlessera
Copy link
Copy Markdown
Member

@felixarntz, a fresh ping for the fresh year... ;)

@felixarntz
Copy link
Copy Markdown
Author

@schlessera Ah totally forgot about this, sorry. At the moment it's unlikely I can get to it in foreseeable future.

@schlessera schlessera added this to the 2.0.9 milestone Jan 5, 2022
@schlessera schlessera changed the title Trigger missing hooks when granting or revoking super admin permissions Trigger core actions when granting or revoking super admin permissions Jan 5, 2022
@schlessera schlessera merged commit 80b8cb8 into wp-cli:master Jan 5, 2022
@schlessera
Copy link
Copy Markdown
Member

Thanks for the PR, @felixarntz !

schlessera added a commit that referenced this pull request Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:super-admin-add Related to 'super-admin add' command command:super-admin-remove Related to 'super-admin remove' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants