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
Hi Vladimir,
I added an other filter to my functions.php for an other userrole with restrict_edit_post_type for 2 categories and full rights for ctc_sermon plugin. The problem is that for the user there are still post visible in an other categories.
When I remove one of the functions it works fine, but when the two functions are active exclude_posts_from_edit_restrictions1 doens’t enforce the allow 2 category restriction from rol dominee.
My code looks like this now:
// ure_restrict_edit_post_type Hetbakenbeheren in combinatie met kerkdienstplanning
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(‘hetbakenbeheren’, $current_user->roles) || !in_array(‘kerkdienstplanning’, $current_user->roles)) {
return $restrict_it;
}
$do_not_restrict = array(‘event’, ‘ctc_event’);
if (in_array($post_type, $do_not_restrict)) {
$restrict_it = false;
}
return $restrict_it;
}
// ure_restrict_edit_post_type Dominee in combinatie met preken
add_filter(‘ure_restrict_edit_post_type’, ‘exclude_posts_from_edit_restrictions1’);
function exclude_posts_from_edit_restrictions1($post_type) {
$restrict_it = true;
if (current_user_can(‘dominee’)) {
if ($post_type==’ctc_sermon’) {
$restrict_it = false;
}
}
return $restrict_it;
}
Thanks.