Template variable for checking group membership
Forum rules
Please only request support for mods released by phpbbmodders.net found at either https://github.com/phpbbmodders/ or the MODDB at http://www.phpbb.com
Please only request support for mods released by phpbbmodders.net found at either https://github.com/phpbbmodders/ or the MODDB at http://www.phpbb.com
- RMcGirr83
- Past Contributor
- Posts: 6243
- Joined: 30 Nov 2006, 14:23
- Real name: Rich McGirr
Re: Template variable for checking group membership
No, that is not the purpose of this mod.
-
- New member
- Posts: 4
- Joined: 12 Feb 2014, 04:14
Re: Template variable for checking group membership
Well thanks for this mod, I use it as well. Could you possibly point me the way to what I am looking for? I only need to check against a handful of groups to simply display an image or not to display an image to everyone if that user is in a group or not.
-
- New member
- Posts: 4
- Joined: 12 Feb 2014, 04:14
Re: Template variable for checking group membership
I managed to cook this up by altering a snippet a person named cherokee red created which appears to be working just the way I want, which is the opposite of your code. However I am not sure if this is the best way to achieve the results, this goes in viewtopic.php.
Code: Select all
// Check what group a user is in
if ( !function_exists('group_memberships') )
{
include_once($phpbb_root_path . 'includes/functions_user.'.$phpEx);
}
$groups = group_memberships(false,$poster_id);
foreach ($groups as $poster_groups)
{
$template->assign_vars(array(
'S_GRP_CHK_' . $poster_groups['group_id'] => true
));
}
-
- New member
- Posts: 4
- Joined: 12 Feb 2014, 04:14
Re: Template variable for checking group membership
scratch the above, it works the same way.
-
- Member
- Posts: 66
- Joined: 12 Apr 2010, 17:07
Re: Template variable for checking group membership
@Rich,
Whats the fix specifically? If statement or the php code?
Code: Select all
last edited by RMcGirr83 on 13 Jan 2015, 01:00, edited 9 times in total.
Reason: fixed code if not in group
Whats the fix specifically? If statement or the php code?
- RMcGirr83
- Past Contributor
- Posts: 6243
- Joined: 30 Nov 2006, 14:23
- Real name: Rich McGirr
Re: Template variable for checking group membership
The code to use in the html files.
-
- Member
- Posts: 66
- Joined: 12 Apr 2010, 17:07
Re: Template variable for checking group membership
something else was changed.
what the difference between:
and:
what the difference between:
Code: Select all
if ($users_groups)
and:
Code: Select all
if (sizeof($groups))
- RMcGirr83
- Past Contributor
- Posts: 6243
- Joined: 30 Nov 2006, 14:23
- Real name: Rich McGirr
Re: Template variable for checking group membership
if ($users_groups)
checks if variable is set
if (sizeof($groups))
checks to ensure that the array that is generated has something in it.
Not sure why it matters, just use the code in the first post.
checks if variable is set
if (sizeof($groups))
checks to ensure that the array that is generated has something in it.
Not sure why it matters, just use the code in the first post.
Return to “Modders MOD support”
Who is online
Users browsing this forum: CommonCrawl [Bot] and 0 guests