vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB5 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=263)
-   -   If condition which returns true if the creator of a post belongs to usergroup (https://vborg.vbsupport.ru/showthread.php?t=319661)

GrenadeSpam 07-29-2015 11:28 AM

If condition which returns true if the creator of a post belongs to usergroup
 
For our forums (VB5), I'd like to give staff members a differently coloured backgrounds in their posts. To this end, I'd like to add the HTML class "staffPost" to each post made by a staff member (usergroupid 5 or 6).

I've spent an entire afternoon searching for the right condition, but can't seem to find it. Any help would be greatly appreciated.

In pseudo code:
Code:

<vb:if condition="owner of this post belongs to usergroup 5"> staffPost</vb:if>

delicjous 07-30-2015 10:52 AM

If you would try to change css you should do this by somthing like this in additional.css:

Code:

<vb:if condition="!empty($user['userid']) AND $user['usergroupid'] = 5 OR $user['usergroupid'] = 6">
backgroundcolor: #000;
</vb:if>

So you don't change code in vB-files.

This might help a little bit:
http://forum.vbulletin-germany.com/s...te-Bedingungen

GrenadeSpam 07-31-2015 10:38 AM

I didn't know if conditionals worked in the CSS as well, that's great!

The code you provided doesn't seem to accomplish what I'd like it to, though. This changes the background colour of a post when the user viewing it belongs to group 5 or 6. What I'd like it to do, is change the background colour of posts if the owner of that post belongs to group 5 or 6. Do you happen to know what conditional I could use for that? I can't seem to find it in the thread you linked to...

delicjous 07-31-2015 11:16 AM

Sorry, didn't got it right.
Look into all templates named like conversation...
but that should be a little more tricky... have to change the class in code if conversation userid is in usergroup 5 or 6 and make new css-stuff for that staff-class...
This is what I found right now... but I don't think there is something with $conversation['groupid'] at vb-original-code.

Code:

<vb:if condition="isset($conversation['edit_userid']) AND !$conversation['unpublishdate']">

<vb:if condition="!$conversation['userid']">

If you don't find anything in the code or forums you could ask again and I will think about.
If you find something it would be nice to share it. ;-)

GrenadeSpam 07-31-2015 02:07 PM

I can't seem to find anything thus far, I think I'll might just have to do it the lousy way and hardcode the user ID's into the template...

GrenadeSpam 08-04-2015 11:57 AM

Glenn Vergara provided me with a good solution over at vbulletin.com:

Code:

{vb:data posterInfo, user, fetchUserinfo, {vb:raw conversation['userid']}}
<vb:if condition="$posterInfo['usergroupid'] == 5 OR $posterInfo['usergroupid'] == 6">staffPost</vb:if>

This does exactly what I wanted it to do! :)

http://www.vbulletin.com/forum/forum...28#post4326328

delicjous 08-04-2015 03:38 PM

Quote:

Originally Posted by GrenadeSpam (Post 2552069)
Glenn Vergara provided me with a good solution over at vbulletin.com:

Code:

{vb:data posterInfo, user, fetchUserinfo, {vb:raw conversation['userid']}}
<vb:if condition="$posterInfo['usergroupid'] == 5 OR $posterInfo['usergroupid'] == 6">staffPost</vb:if>

This does exactly what I wanted it to do! :)

http://www.vbulletin.com/forum/forum...28#post4326328

Thanks for post it here.
Looks great and usable in many ways.:)


All times are GMT. The time now is 08:23 AM.

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.01026 seconds
  • Memory Usage 1,731KB
  • 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
  • (5)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete