Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-04-2010, 12:28 AM
Hawk7173 Hawk7173 is offline
 
Join Date: Dec 2004
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default thread title color by usergroup

I picked up a small mod here on the forum that changes a single assigned user's thread title color.........as follows

Quote:
if ($thread['postuserid'] == 3975) {$thread['threadtitle'] = '<span style="color: #8B0000;">' . $thread['threadtitle'] . '</span>';}
However, I would like to assign a color to a specific usergroup rather than a single user.

What change would I need to make in order to do so?

Thanks in advance! Tony
Reply With Quote
  #2  
Old 11-04-2010, 01:35 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<span style="text-decoration: line-through">I think you might be able to use...</span>

I take it back - posts have the user info with them, but it doesn't look like $thread does.
Reply With Quote
  #3  
Old 11-04-2010, 01:54 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You'll have to write a plugin to hook into the thread query (forumdisplay_query) and JOIN with the user table in order to get the postusers usergroupid. Then you'd be able to use $thread['usergroupid'] in the template.
Reply With Quote
  #4  
Old 11-04-2010, 02:01 AM
Hawk7173 Hawk7173 is offline
 
Join Date: Dec 2004
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, But that something that's a bit much over my head
Reply With Quote
  #5  
Old 11-04-2010, 07:53 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this: create a new plugin using hook forumdisplay_query (make up a title and remember to check "Yes" next to "Plugin is Active", don't worry about the other fields), and use this for the code:

PHP Code:
$hook_query_fields .= ', user.userid, user.usergroupid, user.membergroupids ';
$hook_query_joins .= 'LEFT JOIN ' TABLE_PREFIX 'user AS user ON (user.userid = postuserid) ';


// 
then in your other code use something like:

PHP Code:
if (is_member_of($threadgid1gid2, ...)) {$thread['threadtitle'] = '<span style="color: #8B0000;">' $thread['threadtitle'] . '</span>';} 
(of course you want to use actual group id numbers in place of gid1, gid2, etc).
Reply With Quote
  #6  
Old 11-04-2010, 05:26 PM
Hawk7173 Hawk7173 is offline
 
Join Date: Dec 2004
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I created the plugin as written and changed the second plugin and it does not work.

just to make sure I did this correctly, the original plugin I did was in "thread_bit" should that be changed to "thread_query", or should that remain the same?
Reply With Quote
  #7  
Old 11-04-2010, 06:03 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

We need to know *exactly* what you used - write the code and state the hook location for each plugin.
Reply With Quote
  #8  
Old 11-04-2010, 06:23 PM
Hawk7173 Hawk7173 is offline
 
Join Date: Dec 2004
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Went back and double checked and left something out. All is good and thank you all for the help!!!

--------------- Added [DATE]1288900078[/DATE] at [TIME]1288900078[/TIME] ---------------

Is there a way of fixing it so the usernames of those in the same usergroup show the same color under the thread title on the index pages?
Reply With Quote
  #9  
Old 11-04-2010, 11:32 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Hawk7173 View Post
Is there a way of fixing it so the usernames of those in the same usergroup show the same color under the thread title on the index pages?
It's possible but not that easy. You'd have to do a database query to get the user info.
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 05:52 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04733 seconds
  • Memory Usage 2,244KB
  • Queries Executed 13 (?)
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
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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_postinfo_query
  • fetch_postinfo
  • 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