vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Displaying Private Usergroups on profile (https://vborg.vbsupport.ru/showthread.php?t=309420)

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
Code:

{vb:raw template_hook.postbit_userinfo_right}
Then add above:

Code:

<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?


All times are GMT. The time now is 01:55 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01134 seconds
  • Memory Usage 1,729KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete