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, theroles
array 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.
- The topic ‘Content Audit Fields Not Showing Up In Page Editor’ is closed to new replies.