Title: User groups
Last modified: June 20, 2022

---

# User groups

 *  [benorange](https://wordpress.org/support/users/benorange/)
 * (@benorange)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/user-groups-9/)
 * Hi,
 * I am looking for support with suitability for this plugin on our site. Thanks
   in advance.
 * We have [10 user groups](https://snipboard.io/mHB7uU.jpg) for online courses.
   Can this plugin be used to ensure that each user group can only access content
   for their user group (relate an access level to a user group)?
 * Or would we need to add the specific access level to each user?
 * Bw,
    Ben

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Joachim Jensen](https://wordpress.org/support/users/intoxstudio/)
 * (@intoxstudio)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/user-groups-9/#post-15796270)
 * Since RUA currently doesn’t directly integrate with any group plugins, you most
   likely have to add the members manually to each level, yes.
 * What plugin are you using to create user groups? I will see if I can add support
   for it.
 *  Thread Starter [benorange](https://wordpress.org/support/users/benorange/)
 * (@benorange)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/user-groups-9/#post-15796365)
 * Hi Joachim,
 * That’s really kind, thanks for the offer. The custom fields plugin is ACF. As
   mine is a single use case and we have a fair few plugins already.. I decided 
   to go with a more manual approach, calling a function from each restricted resource
   page template. In case it’s helpful to anyone and comments welcome (still figuring
   it out), this is only a draft and haven’t found the ‘last user record update 
   date’ call yet but it’ll look something like this probably:
 *     ```
       function authorise_access(){
       	$resource_type = get_field('resource-type'); 
       	$user_group = get_user_meta('user-group', get_current_user_id() );
       	$last_update = strtotime(get_user_meta(‘LAST_USER_MODIFIED_DATE‘, get_current_user_id() ));
       	$current_date_s = time(); 
               $secs = $current_date - $last_update;
               $days = $secs / 86400;
       	$permissions = [
       		'Type 1' => ['User group 1', 'User group 1 & 2', ‘User group 1 & 3’], 
       		'Type 2' => ['User group 2', 'User group 1 & 2', ‘User group 2 & 3’], 	
       		'Type 3' => ['User group 3', 'User group 1 & 3', ‘User group 2 & 3’]
       	];
       	if(in_array($user_group, $permissions[$resource_type]) ){ 
       		If ($days < 366){
       	               <style type="text/css">.advert-banner{ 
                              display:none; 
                       	}</style>
       			return null; 
       		}
       	}
               header('Location: https://'. get_site_url.'/promotion');
       }
       ```
   
 * This requires a ‘authorise_access();’ call in restricted pages’ templates and
   using ACF to add the resource-type field and values for restrictions to compare
   to user groups.
 * This function also hides a promo div as these user groups have already signed
   up.
 * Bw
    Ben

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘User groups’ is closed to new replies.

 * ![](https://ps.w.org/restrict-user-access/assets/icon-256x256.png?rev=1815922)
 * [Restrict User Access - Ultimate Membership & Content Protection](https://wordpress.org/plugins/restrict-user-access/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/restrict-user-access/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/restrict-user-access/)
 * [Active Topics](https://wordpress.org/support/plugin/restrict-user-access/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/restrict-user-access/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/restrict-user-access/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [benorange](https://wordpress.org/support/users/benorange/)
 * Last activity: [3 years, 10 months ago](https://wordpress.org/support/topic/user-groups-9/#post-15796365)
 * Status: not a support question