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.
https://wordpress.org/plugins/view-admin-as/
GNU General Public License v2.0
45 stars 3 forks source link

Integrate with Simple History #114

Open JoryHogeveen opened 4 years ago

JoryHogeveen commented 4 years ago

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

Requirements:

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

Required PR: https://github.com/bonny/WordPress-Simple-History/pull/227

JoryHogeveen commented 4 years ago

@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

bonny commented 4 years ago

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.

JoryHogeveen commented 4 years ago

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

JoryHogeveen commented 4 years ago

@bonny

I also think these type of loggers should be opt-in, agreed? Related: https://github.com/bonny/WordPress-Simple-History/issues/204

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

JoryHogeveen commented 4 years ago

@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

JoryHogeveen commented 4 years ago

@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