Group Statement
Posted: 25 Mar 2010, 09:17
Group Statement
Code by RMcGirr83
This code can be used to show specific content to specific groups, or the other way around.
It could be that you want to display ads for registered users, but not your VIP Group.
Open includes/functions.php
Find:
Before add:
Now you can use the group statement in the templates.
If you you want to show some content to a specific group:
Or if you want to show some content like ads to all groups except one:
You have to change the ID in the code with the actual group ID which is a number.
Code by RMcGirr83
This code can be used to show specific content to specific groups, or the other way around.
It could be that you want to display ads for registered users, but not your VIP Group.
Open includes/functions.php
Find:
Code: Select all
// The following assigns all _common_ variables that may be used at any point in a template.
Code: Select all
if ( !function_exists('group_memberships') )
{
include($phpbb_root_path . 'includes/functions_user.'.$phpEx);
}
$groups = group_memberships(false,$user->data['user_id']);
foreach ($groups as $grouprec)
{
$template->assign_vars(array(
'S_GROUP_' . $grouprec['group_id'] => true
));
}
If you you want to show some content to a specific group:
Code: Select all
<!-- IF S_GROUP_ID -->Content here<!-- ENDIF -->
Code: Select all
<!-- IF not S_GROUP_ID -->Content here<!-- ENDIF -->