Content Audit Fields Not Showing Up In Page Editor
-
I’m trying to test this plugin a bit, and I’ve come across a bit of an issue.
Within the admin area, when editing a piece of content, the “Content Audit Notes” meta box is empty, no matter what I do.
Looking at the code, there are a few reasons for this:
1) The plugin is testing entirely based on the user’s role. In a multisite installation, Super/Network Admins may not have an explicit role on an individual site (or may have the default user role of “Subscriber”), but they should still have access to the notes.
2) The code that attempts to grab the user’s role is assuming that the array of roles will be 0-indexed. In my case, for whatever reason, therolesarray consisted of one element with a key of12, rather than a key of0. Therefore, trying to grab$current_user->roles[0]was returning nothing.I would recommend the following changes to the
content_audit_notes_meta_box()function:$role = $current_user->roles[0];Should be changed to:
$role = is_array( $current_user->roles ) ? array_shift( $current_user->roles ) : '';And:
if ( in_array( $role, $allowed ) )Should probably be changed to something like:
if ( ( is_multisite() && is_super_admin() ) || in_array( $role, $allowed ) )Based on a very cursory search, it looks like similar changes should be made to the
content_audit_taxonomies(),content_audit_boxes(),content_audit_owner_meta_box(),content_audit_exp_date_meta_box(),save_content_audit_meta_data()andcontent_audit_quickedit()functions, as well. Thanks.
-
Just as a follow-up, it looks like these changes would also be useful within the following functions in content-audit-report.php, as well.
content_audit_column_setup()content_audit_columns()content_audit_front_end_display()content_audit_front_end_css()
If it’s helpful, I’m happy to put together an SVN patch or a Git pull request (if you have this plugin in a Git repo anywhere) for these changes. Thanks.
Thanks for this information!
Thank you, Curtiss! I’m slowly getting all my plugins up on GitHub. I would love a pull request for this:
https://github.com/sillybean/content-auditI’m also planning to add some hooks and filters throughout. The CSV columns, for sure. Anything else you’ve come across that would be handy to modify?
The topic ‘Content Audit Fields Not Showing Up In Page Editor’ is closed to new replies.