Jump to the post that solved this thread.
Solved: 5 Years, 5 Months, 1 Week ago Hiding certain fields (reputation) for Admin usergroup via profile?
#1
Solved: 5 Years, 5 Months, 1 Week ago
What can I use to hide certain fields (such as reputation and other variables) in the member_profile templates for specific usergroups?

There are a few areas I would like to hide for admin only, but not sure what code to use. (I do have PHP Template Conditionals installed already)

For example, on admin only profiles (gid 4), I want reputation field to be hidden
Reply
#2
Solved: 5 Years, 5 Months, 1 Week ago
This should show the content for the groups you choose only.

<if $user['usergroup'] != 1 or $user['usergroup'] != 2 then>
Your content
</if>
[Image: sig2.jpg]
Reply
#3
Solved: 5 Years, 5 Months, 1 Week ago
(2019-08-08, 01:33 AM)iAndrew Wrote: This should show the content for the groups you choose only.

<if $user['usergroup'] != 1 or $user['usergroup'] != 2 then>
Your content
</if>

Did not entirely work.

I just want to hide for example, reputation for admin users on member_profile (even when disabled in the usergroup settings, it still shows on profile)

Bump for assistance.
Reply
#4
Solved: 5 Years, 5 Months, 1 Week ago
Bump for assistance.
Reply
#5
Solved: 5 Years, 5 Months, 1 Week ago
Bump for assistance.
Reply
#6
Solved: 5 Years, 5 Months, 1 Week ago
I'm not sure if this works.

$mybb->user['usergroup'] -> It's the usergroup of user who are viewing  the forum, maybe you.
$memprofile['usergroup'] -> It's the usergroup of which user you're viewing.

If you don't want users who are not in a particular group to see something, use the first one. Or if you want to hide some fields of users from a particular group, use the second one.

For example, prevent others from viewing reputation of users in the Administrators group, you'd like to have this in the member_profile template (I don't use PHP Template Conditionals, correct any syntax error yourself please), replace {$reputation} with:
<if $memprofile['usergroup'] == 4 then>
Hidden content.
<else />{$reputation}</if> 
Could be wrong but worth a try.
Email me at: [email protected]
Reply
#7
Solved: 5 Years, 5 Months, 1 Week ago
(2019-08-08, 03:11 AM)makpaolo Wrote: I just want to hide for example, reputation for admin users on member_profile (even when disabled in the usergroup settings, it still shows on profile)
Probably because is hard coded the reputation field in your template and there's no need to hard code also the view condition. If you use {$reputation} variable in member_profile, member permissions will be automatically considered.
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)