Give user access by category name
-
I’ve set a number of groups in relation to category names,
Now I’m trying to give user access page content by getting the category name and matching it to the user group?
<?php $user_id = get_current_user_id(); $groupname = get_single_cat_title(); $group = Groups_Group::read_by_name( $groupname ); if ( Groups_User_Group::read( $user_id, $group->group_id ) ) { echo 'access granted'; } else { echo 'access denied'; } ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Give user access by category name’ is closed to new replies.