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

Reply
 
Thread Tools Display Modes
  #1  
Old 12-31-2015, 10:55 PM
cshellworld cshellworld is offline
 
Join Date: Sep 2013
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Little help

How can i color only the name Started By name but name to be colored

look at picture , just the black marked username depending by usergroup

Thanks in advance
Attached Images
File Type: jpg start.jpg (20.9 KB, 0 views)
Reply With Quote
  #2  
Old 01-01-2016, 04:23 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That whole line "Started by xxxx, date" is under the class of label. So, if you use CSS to change the class label to another color, that whole like will get changed. Therefore, you would need to edit the template to add a class only around those two words.

To find the template to modify, do this - vboptions > General Settings > Add Template Name in HTML Comments > set to Yes . Then go back to your page and view the source code and you will see the name of the template called around your part of the code. (Sometimes the template is the one mentioned at the very top of the page source.)
Reply With Quote
  #3  
Old 01-01-2016, 07:01 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's what you can do:

1.) Create a new phrase:

Language: MASTER LANGUAGE

Phrase Type: GLOBAL

Product: vBulletin

Varname: m_started_by_x_y_z_a

Text:

HTML Code:
<span class="label">Started by&nbsp;<a href="{1}" class="username understate" title="Started by {2} on {4} {5}">{3}</a>{6},&nbsp;{4}&nbsp;{5}</span>
Click "Save"

2.) Create new plugins:

First plugin:

Product: vBulletin

Hook Location: threadbit_display

Title: Username Markup In Threadbit (threadbit)

Execution Order: 5

Plugin PHP Code:

PHP Code:
global $db$vbulletin;

$authors $vbulletin->db->query_read("
    SELECT user.*
    FROM " 
TABLE_PREFIX "user AS user
    WHERE userid = " 
$thread['postuserid']
);

$author $db->fetch_array($authors);

if (
$author['displaygroupid'])
{
    
$groupid $author['displaygroupid'];
}
else
{
    
$groupid $author['usergroupid'];
}

$open_tag $vbulletin->usergroupcache[$groupid]['opentag'];
$close_tag $vbulletin->usergroupcache[$groupid]['closetag'];

$thread['postmusername'] = ($open_tag $thread['postusername'] . $close_tag); 
Plugin is Active: Yes

Click "Save"

Second Plugin:

Product: vBulletin

Hook Location: search_results_threadbit

Title: Username Markup In Threadbit (search_results)

Execution Order: 5

Plugin PHP Code:

PHP Code:
global $db$vbulletin;

$authors $vbulletin->db->query_read("
    SELECT user.*
    FROM " 
TABLE_PREFIX "user AS user
    WHERE userid = " 
$thread['postuserid']
);

$author $db->fetch_array($authors);

if (
$author['displaygroupid'])
{
    
$groupid $author['displaygroupid'];
}
else
{
    
$groupid $author['usergroupid'];
}

$open_tag $vbulletin->usergroupcache[$groupid]['opentag'];
$close_tag $vbulletin->usergroupcache[$groupid]['closetag'];

$thread['postmusername'] = ($open_tag $thread['postusername'] . $close_tag); 
Plugin is Active: Yes

Click "Save"

3.) Edit templates (for each style you want to change): threadbit, threadbit_deleted, search_threadbit

Find each instance of:

HTML Code:
{vb:rawphrase started_by_x_y_z_a, {vb:link member, {vb:raw thread}, null, 'postuserid', 'postusername'}, {vb:raw thread.postusername}, {vb:raw thread.startdate}, {vb:raw thread.starttime}, {vb:stylevar dirmark}}
and change it to:

HTML Code:
{vb:rawphrase m_started_by_x_y_z_a, {vb:link member, {vb:raw thread}, null, 'postuserid', 'postusername'}, {vb:raw thread.postusername}, {vb:raw thread.postmusername}, {vb:raw thread.startdate}, {vb:raw thread.starttime}, {vb:stylevar dirmark}}
Reply With Quote
Благодарность от:
Lynne
  #4  
Old 01-01-2016, 07:10 PM
CAG CheechDogg's Avatar
CAG CheechDogg CAG CheechDogg is offline
 
Join Date: Feb 2012
Location: Riverside, California USA
Posts: 1,080
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarkFL View Post
Here's what you can do:

1.) Create a new phrase:

Language: MASTER LANGUAGE

Phrase Type: GLOBAL

Product: vBulletin

Varname: m_started_by_x_y_z_a

Text:

HTML Code:
<span class="label">Started by&nbsp;<a href="{1}" class="username understate" title="Started by {2} on {4} {5}">{3}</a>{6},&nbsp;{4}&nbsp;{5}</span>
Click "Save"

2.) Create new plugins:

First plugin:

Product: vBulletin

Hook Location: threadbit_display

Title: Username Markup In Threadbit (threadbit)

Execution Order: 5

Plugin PHP Code:

PHP Code:
global $db$vbulletin;

$authors $vbulletin->db->query_read("
    SELECT user.*
    FROM " 
TABLE_PREFIX "user AS user
    WHERE userid = " 
$thread['postuserid']
);

$author $db->fetch_array($authors);

if (
$author['displaygroupid'])
{
    
$groupid $author['displaygroupid'];
}
else
{
    
$groupid $author['usergroupid'];
}

$open_tag $vbulletin->usergroupcache[$groupid]['opentag'];
$close_tag $vbulletin->usergroupcache[$groupid]['closetag'];

$thread['postmusername'] = ($open_tag $thread['postusername'] . $close_tag); 
Plugin is Active: Yes

Click "Save"

Second Plugin:

Product: vBulletin

Hook Location: search_results_threadbit

Title: Username Markup In Threadbit (search_results)

Execution Order: 5

Plugin PHP Code:

PHP Code:
global $db$vbulletin;

$authors $vbulletin->db->query_read("
    SELECT user.*
    FROM " 
TABLE_PREFIX "user AS user
    WHERE userid = " 
$thread['postuserid']
);

$author $db->fetch_array($authors);

if (
$author['displaygroupid'])
{
    
$groupid $author['displaygroupid'];
}
else
{
    
$groupid $author['usergroupid'];
}

$open_tag $vbulletin->usergroupcache[$groupid]['opentag'];
$close_tag $vbulletin->usergroupcache[$groupid]['closetag'];

$thread['postmusername'] = ($open_tag $thread['postusername'] . $close_tag); 
Plugin is Active: Yes

Click "Save"

3.) Edit templates (for each style you want to change): threadbit, threadbit_deleted, search_threadbit

Find each instance of:

HTML Code:
{vb:rawphrase started_by_x_y_z_a, {vb:link member, {vb:raw thread}, null, 'postuserid', 'postusername'}, {vb:raw thread.postusername}, {vb:raw thread.startdate}, {vb:raw thread.starttime}, {vb:stylevar dirmark}}
and change it to:

HTML Code:
{vb:rawphrase m_started_by_x_y_z_a, {vb:link member, {vb:raw thread}, null, 'postuserid', 'postusername'}, {vb:raw thread.postusername}, {vb:raw thread.postmusername}, {vb:raw thread.startdate}, {vb:raw thread.starttime}, {vb:stylevar dirmark}}
Just tried this but didn't work ....
Reply With Quote
  #5  
Old 01-01-2016, 07:12 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by CAG CheechDogg View Post
Just tried this but didn't work ....
What was the result?
Reply With Quote
  #6  
Old 01-01-2016, 07:15 PM
CAG CheechDogg's Avatar
CAG CheechDogg CAG CheechDogg is offline
 
Join Date: Feb 2012
Location: Riverside, California USA
Posts: 1,080
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The usernames are still in the default color of white ....
Reply With Quote
  #7  
Old 01-01-2016, 07:18 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by CAG CheechDogg View Post
The usernames are still in the default color of white ....
Did you edit the templates for the style you are using to view your forum? (I don't mean to come off like I am asking you if you plugged in the appliance...)
Reply With Quote
  #8  
Old 01-01-2016, 07:29 PM
CAG CheechDogg's Avatar
CAG CheechDogg CAG CheechDogg is offline
 
Join Date: Feb 2012
Location: Riverside, California USA
Posts: 1,080
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarkFL View Post
Did you edit the templates for the style you are using to view your forum? (I don't mean to come off like I am asking you if you plugged in the appliance...)

Ah yes? :erm: .... ....

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

Thanks Mark ..works good lol ..
Reply With Quote
2 благодарности(ей) от:
Dragonsys, MarkFL
  #9  
Old 01-01-2016, 07:33 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by CAG CheechDogg View Post
Ah yes? :erm: .... ....

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

Thanks Mark ..works good lol ..
I need to work this into a product, so it works in all styles with no template edits. As it is now, those db queries are being run no matter which style you are using. I will do this soon.
Reply With Quote
  #10  
Old 01-01-2016, 07:41 PM
CAG CheechDogg's Avatar
CAG CheechDogg CAG CheechDogg is offline
 
Join Date: Feb 2012
Location: Riverside, California USA
Posts: 1,080
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarkFL View Post
I need to work this into a product, so it works in all styles with no template edits. As it is now, those db queries are being run no matter which style you are using. I will do this soon.
Good stuff !!!! thank you Mark !!!
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 07:06 PM.


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.05542 seconds
  • Memory Usage 2,334KB
  • Queries Executed 14 (?)
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
  • (6)bbcode_html
  • (4)bbcode_php
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (3)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete