View Full Version : Displaying Private Usergroups on profile
Elixar
03-11-2014, 05:54 PM
I've seen it done before, but for some reason it has slipped my mind. :D
ozzy47
03-11-2014, 10:04 PM
To the user that is viewing their own profile? http://YOURSITE.com/profile.php?do=editusergroups
Elixar
03-11-2014, 11:13 PM
No, to other usergroups like Staff.
Elixar
03-15-2014, 05:25 AM
Like this on the profiles:
https://vborg.vbsupport.ru/external/2014/03/43.png
tbworld
03-15-2014, 06:41 AM
Are you referring to 'usergroups' or 'social groups' (Groups)?
If your are referring to 'usergroups' then you need to be a bit more exacting with your request. The '$post' variable will contain information regarding the poster, including his/her 'usergroups', '$vbulletin->userinfo' or $bbsuserinfo will contain the current user's information including usergroups. Obviously, if they have the same user-group 'in common they are both registered in the same usergroup. If not, then I guess you can say the 'usergroup' is private to them, but that could be quite a list.
Are you simply trying to show that they do not have access to special/key user-groups? If so, just check for specific instances.
In order for us to to help you, you will need to define the word 'private' as it refers to user-groups and/or permissions.
For simple user-group conditional in the templates just use.
<vb:if condition="is_member_of($post, xx)">
Some template html here
</vb:if>
Here is a couple of other references that you can use as examples:
https://vborg.vbsupport.ru/showthread.php?t=233661
https://vborg.vbsupport.ru/showthread.php?t=287513
If you Google vbulletin.org with your criteria you will find lots of interesting references.
Elixar
03-15-2014, 02:14 PM
Like for example, on a forum I'm on, it does list the private groups a member is in, but it hidden to only the Staff
Like so:
https://vborg.vbsupport.ru/external/2014/03/40.png
ozzy47
03-15-2014, 11:43 PM
That is by design, if all members were to be able to see "private groups" they would no longer be private. :)
tbworld
03-16-2014, 12:26 AM
I understand what you are looking for, but as there is no 'MOD' directly for this how can we help?
Elixar
03-16-2014, 01:52 AM
That is by design, if all members were to be able to see "private groups" they would no longer be private. :)
I just want Staff to be able to see what groups members are in. :)
I understand what you are looking for, but as there is no 'MOD' directly for this how can we help?
How is it possible to do it?
ozzy47
03-16-2014, 01:55 AM
I just want Staff to be able to see what groups members are in. :)
How is it possible to do it?
Is that what you said here:
Like for example, on a forum I'm on, it does list the private groups a member is in, but it hidden to only the Staff
Like so:
https://vborg.vbsupport.ru/external/2014/03/40.png
That it is viewable to staff?
Elixar
03-16-2014, 01:57 AM
Yep Ozzy. :)
ozzy47
03-16-2014, 01:59 AM
So only staff is seeing the private groups, is that not what you are asking?
Or am I just totally lost. :p
Elixar
03-16-2014, 02:05 AM
Yes that's what I mean, only Staff groups can see them. :)
cellarius
03-17-2014, 02:59 PM
There's two ways basically. If you have just a few usergroups and don't change them often, you could just do this using several if-conditions in the template. Disadvantage: If you add a new usergroup, you have to edit the template again. But normally you probably won't do that all that often. (Very) big advantage: You save database queries.
You'd go as follows:
In postbit or postbit_legacy template find
{vb:raw template_hook.postbit_userinfo_right}
Then add above:
<vb:if condition="in_array($bbuserinfo['usergroupid'], array(5,6,7))">
<span style="font-weight: bold;">Usergroups:<br /></span>
<vb:if condition="in_array($post['usergroupid'], array(6))">Administrator</vb:if>
<vb:if condition=" in_array($post['usergroupid'], array(5))">Super-Moderator</vb:if>
<vb:if condition=" in_array($post['usergroupid'], array(7))">Moderator</vb:if>
<vb:if condition=" in_array($post['usergroupid'], array(2))">Registered User</vb:if>
</vb:if>
I think you get the drill. Just add another line per usergroup you want to show.
Doing it with a plugin would be a bit more complicated, and would add a query per post on the page.
Elixar
03-17-2014, 05:24 PM
Hey there, thanks! Unfortunately I'm not seeing it show up on the profiles.
cellarius
03-17-2014, 10:44 PM
Ouch, I thought you wanted it on postbit. Just replace every occurence of $post with $prepared and add it to the profile template, wherever you want to show it. That should work.
Elixar
03-18-2014, 12:17 AM
Which profile template?
cellarius
03-18-2014, 01:57 PM
OK, I had a closer look into the matter, and it is in fact possible to achieve what you want in a more comfortable way, w/o needing to query the database (all necessary information is present in the datastore-cache and can be pulled from there).
I made a little addon out of it: https://vborg.vbsupport.ru/showthread.php?t=309645
Elixar
03-18-2014, 04:47 PM
I tested it out, and unfortunately they didn't appear on the profile and I got an error. I hate to be a huge bother.
cellarius
03-18-2014, 05:12 PM
No bother at all; I think I found a minor error, just fixing it atm. Could you tell me exactly what your error is, though?
Elixar
03-18-2014, 05:17 PM
I get that:
Warning: include(cel/ugdisplay/code.php): failed to open stream: No such file or directory in ..../member.php(599) : eval()'d code on line 6
Warning: include(cel/ugdisplay/code.php): failed to open stream: No such file or directory in ..../member.php(599) : eval()'d code on line 6
Warning: include(): Failed opening 'cel/ugdisplay/code.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in ..../member.php(599) : eval()'d code on line 6
cellarius
03-18-2014, 05:30 PM
You did not upload the files in the UPLOAD folder, or else you uploaded them to the wrong place. There needs to be a folder called "cel" in your forum root after upload.
Elixar
03-18-2014, 05:34 PM
There we go, works. :)
Can I ask what this means?
https://vborg.vbsupport.ru/external/2014/03/36.png
How does one add groups to show up?
cellarius
03-18-2014, 05:41 PM
Well, that is pretty much explained in the description, is it not? It's a comma seperated list, and you just add the ids of those usergroups that are supposed to see the box, too.
To find out the id of an usergroup, just go to the usergroup manager and look it up there.
BTW: Please ask further questions in the addon thread :)
Elixar
03-18-2014, 05:42 PM
Oh okay, I just got confused to where it said they will always be shown online. :)
cellarius
03-18-2014, 05:43 PM
Oh okay, I just got confused to where it said they will always be shown online. :)
Damn. That happens if you copy text snippets from another addon. Please ignore that, I'll fix that :p
Elixar
03-18-2014, 05:44 PM
Haha, I thought it was something like that. :P
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.