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:55
#4826
Vladimir
Keymaster
That is you should have this code in your functions.php finally:
// User role editor pro - Show all attachments for all roles
add_filter('ure_attachments_show_full_list', 'show_full_list_of_attachments', 10, 1);
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;
}
// ure_restrict_edit_post_type
add_filter('ure_restrict_edit_post_type', 'exclude_posts_from_edit_restrictions');
function exclude_posts_from_edit_restrictions($post_type) {
$restrict_it = true;
$current_user = wp_get_current_user();
if (in_array($post_type, array('event', 'ctc_event'))) {
if (in_array('hetbakenbeheren', $current_user->roles) && in_array('kerkdienstplanning', $current_user->roles)) {
$restrict_it = false;
}
} elseif ($post_type=='ctc_sermon') {
if (in_array('dominee', $current_user->roles)) {
$restrict_it = false;
}
}
return $restrict_it;
}