Your cart is currently empty!
Assigning a capability to Guests
—
by
I was wondering if there is a way to allow Guests to access certain capabilities (that I’m using to restrict content access).
Posted in Groups Restrict Categories
—
by
I was wondering if there is a way to allow Guests to access certain capabilities (that I’m using to restrict content access).
Comments
3 responses to “Assigning a capability to Guests”
Hi Moises,
The filter groups_user_can accepts 3 parameters one of which is user object. If the user is not logged in, then there is no user obj.
Kind regards,
George
I know I might be simplifying the code but would something similar to this would work?
add_filter( ‘groups_user_can’, ‘my_force_cap’, 1, 3);
function my_force_cap(){
if (!is_user_logged_in()){
return true;
}
}
Hi Moises,
Sorry but no, access restrictions can only apply to registered users.
Kind regards,
George