Change WordPress user roles and capabilities › Forums › Give user access to plugin – how to › Limit user to changing a single page & add events through multiple plugins › Reply To: Limit user to changing a single page & add events through multiple plugins
03/05/2018 at 07:51
#4824
Vladimir
Keymaster
Got it.
Check your child theme functions.php file.
1)
Line #174 will never work:
if (!current_user_can('hetbakenbeheren' or 'jaarboekje' or 'kerkdienstplanning')) {
as such role this expression “‘hetbakenbeheren’ or ‘jaarboekje’ or ‘kerkdienstplanning'” is evaluated to a boolean result, but current_user_can() function wait that its argument will be a string with a role ID.
You have to use this code:
function show_full_list_of_attachments($show_all) {
//if (!current_user_can('hetbakenbeheren' or 'jaarboekje' or 'kerkdienstplanning')) {
$current_user = wp_get_current_user();
if (!in_array('hetbakenbeheren', $current_user->roles) && !in_array('jaarboekje', $current_user->roles) &&
!in_array('kerkdienstplanning', $current_user->roles)) {
return $show_all;
}
return true;
}
In order users with one of those 3 roles see full list of attachments, but any other restricted user will still see just his own attachments in the Media Library.