One thing I love about ocPortal is the infinite customisation ability of the software, and a very useful piece of code is the If_in_group tag which allows you to specify different things to happen depending on which group the user is in. You can display a message to guests and a different message to members. The tag allows you to use ocPortal’s comcode to display blocks of information or different content to your members.
An example of this is you might want to display a gallery on the homepage to premium members but not anyone else. You can also do this with permissions too.
Using the If_in_group tag on a page
There are two types of places you might want to use the if_in_group tag. One of them is on a normal page which you edit in the normal way. The second is as part of the website template which I will cover further down. To add the code to a normal page you will need to use the example below:
[if_in_group="1,2,6,7"]Here would be a custom welcome message which only members of groups 1, 2 6 & 7 would see[/if_in_group]
[if_in_group="3,4,5,8"]Here would be a custom welcome message which Members of groups 3,4,5 & 8 would see[/if_in_group]
In this example you can see there would be two different messages displayed to 2 different groups of usergroups. You could add as many different as you like. If you only want a message for guests you would just use group 1. If you want to show another message to everyone else, rather than add each number in turn (2,3,4,5,6,…….) you can use 2+ and this will display to every group numbers 2 and higher.
There are quite a few different syntax you can use to customise which groups will see your messages; there is a full list of the Syntax here.
Using the If in Group tag in Templates
If you would like to use the If_in_group tag on a template, the code will change a little as the templates in ocPortal use Tempcode rather than Comcode. An example of what the code would look like is below. In this example the text would appear if the user was logged in and a member of group 7 or above
What you want to appear goes here
I do urge you to be careful when editing any of the templates as it is possible you could break your site. If in doubt, you can ask for help on either the Arvixe forums or the ocPortal forums where someone will be able to help or leave a comment below.