vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Little help (https://vborg.vbsupport.ru/showthread.php?t=321284)

cshellworld 12-31-2015 10:55 PM

Little help
 
1 Attachment(s)
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

Lynne 01-01-2016 04:23 PM

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

MarkFL 01-01-2016 07:01 PM

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

CAG CheechDogg 01-01-2016 07:10 PM

Quote:

Originally Posted by MarkFL (Post 2561635)
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 ....

MarkFL 01-01-2016 07:12 PM

Quote:

Originally Posted by CAG CheechDogg (Post 2561640)
Just tried this but didn't work ....

What was the result?

CAG CheechDogg 01-01-2016 07:15 PM

The usernames are still in the default color of white ....

MarkFL 01-01-2016 07:18 PM

Quote:

Originally Posted by CAG CheechDogg (Post 2561643)
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...:))

CAG CheechDogg 01-01-2016 07:29 PM

Quote:

Originally Posted by MarkFL (Post 2561645)
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: ....:rolleyes: ....

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

Thanks Mark ..works good lol ..

MarkFL 01-01-2016 07:33 PM

Quote:

Originally Posted by CAG CheechDogg (Post 2561646)
Ah yes? :erm: ....:rolleyes: ....

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

CAG CheechDogg 01-01-2016 07:41 PM

Quote:

Originally Posted by MarkFL (Post 2561650)
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 !!!


All times are GMT. The time now is 06:35 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.02587 seconds
  • Memory Usage 1,782KB
  • 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
  • (6)bbcode_html_printable
  • (4)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete