This will let other modules affect masquerade's behavior, and identify when masquerade events are about to take place, or when they do take place. See the attached patch.
This patch adds:

  • HOOK_masquerade_to_begin(): Identifies when a masquerade is about to start.
  • HOOK_masquerade_to_end(): Identifies when a masquerade is about to end.
  • HOOK_masquerade_began(): Identifies when a masquerade has started.
  • HOOK_masquerade_ended(): Identifies when a masquerade has ended.

Comments

wjaspers’s picture

Status: Active » Needs review
StatusFileSize
new5.14 KB

Noticed a minor documentation mistake. I should be accessing parameters by reference. But easy fix. See attached.

mrfelton’s picture

StatusFileSize
new3.49 KB

Patch updated to apply to latest dev code. @wjaspers, is this implementation compatible with your 7.x-1.x-rules branch of masquerade_extras. Haven't actually tried it yet, but I assume you wrote the code in that branch with this patch installed since ti relies on the hooks defined here.

wjaspers’s picture

@mrfelton,
This is compatible with the 7.x-1.x branch.
All I need to do is drop in the submodule which contains the rules implementation needed.

wjaspers’s picture

Status: Needs review » Needs work

I also noticed your version of the patch is missing the .api.php documentation file.

wjaspers’s picture

andypost’s picture

Issue summary: View changes
Related issues: +#1547058: Add hooks when user starts or stops masquerading

I think it's not good idea to expose 4 hooks, in related issue only 2

ressa’s picture

Status: Needs work » Closed (outdated)

Thanks for working on this. In an attempt to help the maintainers, I am going through some of the Drupal 7 issues, and closing them, since Drupal 7 is EOL.

Maintainers should grant credit for the great work to the relevant users, even if the patch did not get committed: https://www.drupal.org/docs/develop/issues/issue-procedures-and-etiquett....

Since Drupal 7 is EOL, we can probably close this issue, but feel free to re-open if this is still relevant, and we should consider adding this to the Drupal 11 version?

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.