Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-29-2015, 11:28 AM
GrenadeSpam GrenadeSpam is offline
 
Join Date: Jun 2015
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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>
Reply With Quote
  #2  
Old 07-30-2015, 10:52 AM
delicjous's Avatar
delicjous delicjous is offline
 
Join Date: Nov 2014
Posts: 352
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #3  
Old 07-31-2015, 10:38 AM
GrenadeSpam GrenadeSpam is offline
 
Join Date: Jun 2015
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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...
Reply With Quote
  #4  
Old 07-31-2015, 11:16 AM
delicjous's Avatar
delicjous delicjous is offline
 
Join Date: Nov 2014
Posts: 352
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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. ;-)
Reply With Quote
  #5  
Old 07-31-2015, 02:07 PM
GrenadeSpam GrenadeSpam is offline
 
Join Date: Jun 2015
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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...
Reply With Quote
  #6  
Old 08-04-2015, 11:57 AM
GrenadeSpam GrenadeSpam is offline
 
Join Date: Jun 2015
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #7  
Old 08-04-2015, 03:38 PM
delicjous's Avatar
delicjous delicjous is offline
 
Join Date: Nov 2014
Posts: 352
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by GrenadeSpam View Post
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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:31 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.06407 seconds
  • Memory Usage 2,223KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete