• Hi,

    I am looking for support with suitability for this plugin on our site. Thanks in advance.

    We have 10 user groups 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

    (@intoxstudio)

    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

    (@benorange)

    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.