JoryHogeveen / view-admin-as

View the WordPress admin as a different role, switch between users, temporarily change your capabilities, set default screen settings for roles, manage your roles and capabilities.

Home Page:https://wordpress.org/plugins/view-admin-as/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Integrate with Simple History

JoryHogeveen opened this issue · comments

Request: https://wordpress.org/support/topic/simple-history-integration/
https://wordpress.org/plugins/simple-history/

Requirements:

  • Proper hooks to trigger changes in views (1.8.x)
    • vaa_view_admin_as_update_view: c1c2ebd
    • vaa_view_admin_as_reset_view: 6df0f83
    • vaa_view_admin_as_cleanup_views: c3b9166
    • vaa_view_admin_as_reset_all_views: 98cfb0f
  • Either integrate within View Admin As or create a PR for Simple History

Example addon: https://github.com/bonny/WordPress-Simple-History/blob/master/loggers/PluginUserSwitchingLogger.php

Required PR: bonny/WordPress-Simple-History#227

@bonny

Viewing the above, what do you think about me adding an integration addon as a PR to your plugin?
I'll make sure it's all based on WP actions so it doesn't have to rely on classnames etc.

Also, just an idea. What do you think about (optionally) adding a "switched from" status to other logs when a user does things while switched to another user?

Cheers, Jory

Hi @JoryHogeveen ! A PR would definitely be nice, support for View Admin As would benefit users that use both our plugins.

The "swithed from" is a nice idea, I never though of that when I added support for User Switching. Not sure right now how that would be displayed however. If you have any ideas let me know.

Awesome, I'll think about the "switched from" implementation and do some testing. Cheers!

@bonny

I also think these type of loggers should be opt-in, agreed?
Related: bonny/WordPress-Simple-History#204

Especially the "switched from" part. I can imagine both pro and con's for these type of logs.

@bonny

Found a bottleneck while testing. View Admin As makes all changes really early in WP load time (first prio on plugins_loaded). At that point the loggers aren't available yet.
Any suggestions to how I could get around that?

Cheers, Jory

@bonny

I've tried several ways without modifying your plugin but it's currently impossible to make our plugins compatible.
View Admin As hangles view changes very early-on in the WP hooks and it directly returns AJAX data after that.
Because of this the after_setup_theme hook is never fired and this the loggers aren't loaded.
There will be some changes required to your plugin as well to make this compatible. I'll make a PR for you to review.

Cheers, Jory