vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   thread title color by usergroup (https://vborg.vbsupport.ru/showthread.php?t=253125)

Hawk7173 11-04-2010 12:28 AM

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

kh99 11-04-2010 01:35 AM

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

Lynne 11-04-2010 01:54 AM

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.

Hawk7173 11-04-2010 02:01 AM

Thanks, But that something that's a bit much over my head:(:(:(

kh99 11-04-2010 07:53 AM

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).

Hawk7173 11-04-2010 05:26 PM

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?

Lynne 11-04-2010 06:03 PM

We need to know *exactly* what you used - write the code and state the hook location for each plugin.

Hawk7173 11-04-2010 06:23 PM

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?

kh99 11-04-2010 11:32 PM

Quote:

Originally Posted by Hawk7173 (Post 2117996)
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.


All times are GMT. The time now is 06:22 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.01073 seconds
  • Memory Usage 1,732KB
  • 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_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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