x
 
Create New Page
 View Previous Changes    ( Last updated by Lisa Wess )

Restrict Content

Can I restrict content to certain Member Groups

Yes, you can do this. Generally, the best way is to use the native EE global conditionals:

{if member_group == 1} 
Only SuperAdmins can see this

{/if} 

or

{if group_id == 1} 
Only SuperAdmins can see this

{/if} 

Since version 1.3.1, you can also specify multiple groups:

{if member_group "1" OR member_group "2" OR member_group == "3"
Groups one
six, and eight can see this
{/if} 

For earlier versions of EE, you’ll instead need to use PHP to do this. Set your Template to parse PHP and then use something like this:

<?php 

global $SESS

if ( (
$SESS->userdata['group_id'] 1) || ($SESS->userdata['group_id'] 6) ) 

?> 


Only Groups 1 
and 6 can see this content 

 <?php 


 ?> 

Of course, if you simply wish to restrict an entire Template, then you can easily do that by following the “Access” link for the Template you’re interested in under Templates in the Control Panel.

Category:Tips

Category:EE1

Categories: