View Full Version : Little help
cshellworld
12-31-2015, 10:55 PM
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:
<span class="label">Started by <a href="{1}" class="username understate" title="Started by {2} on {4} {5}">{3}</a>{6}, {4} {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:
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:
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:
{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:
{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
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:
<span class="label">Started by <a href="{1}" class="username understate" title="Started by {2} on {4} {5}">{3}</a>{6}, {4} {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:
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:
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:
{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:
{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
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
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
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 1451683811 at 1451683811 ---------------
Thanks Mark ..works good lol ..
MarkFL
01-01-2016, 07:33 PM
Ah yes? :erm: ....:rolleyes: ....
--------------- Added 1451683811 at 1451683811 ---------------
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
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 !!!
MarkFL
01-03-2016, 04:58 AM
I have attached a product file that will add the phrase for you, and then modify the 3 templates to use the new phrase. :)
edit: I added a plugin that will add username HTML markup to the "Last Post By" Information and anywhere else it does not already exist for the "memberaction_dropdown".
CAG CheechDogg
01-03-2016, 06:55 AM
I have attached a product file that will add the phrase for you, and then modify the 3 templates to use the new phrase. :)
edit: I added a plugin that will add username HTML markup to the "Last Post By" Information and anywhere else it does not already exist for the "memberaction_dropdown".
So we can install this product and it will overwrite the previous changes?
MarkFL
01-03-2016, 01:15 PM
So we can install this product and it will overwrite the previous changes?
I would undo the template changes, and delete the phrases and plugins first then install the product. :)
CAG CheechDogg
01-03-2016, 01:25 PM
I would undo the template changes, and delete the phrases and plugins first then install the product. :)
Good stuff Mark! ...done and looking niiiiiice ! thank you !
ozzy47
01-03-2016, 01:37 PM
Why just not use this mod, https://vborg.vbsupport.ru/showthread.php?t=290368&highlight=Markup then the markup shows everywhere. Or am I missing something?
CAG CheechDogg
01-03-2016, 02:58 PM
Why just not use this mod, https://vborg.vbsupport.ru/showthread.php?t=290368&highlight=Markup then the markup shows everywhere. Or am I missing something?
Does that work for 4.1.x?
ozzy47
01-03-2016, 04:04 PM
AFAIK it does.
CAG CheechDogg
01-03-2016, 04:19 PM
Ok good stuff Ozzy ty !!!
cshellworld
01-03-2016, 08:39 PM
Good , that is the thing what i'm looking. thanks mark
CAG CheechDogg
01-05-2016, 02:36 AM
Mark My Man check this out, after I added those 2 plugins to do the markup for the threadbit, threadbit_deleted, search_threadbit I get the following...notice the username's are displayed twice?
https://vborg.vbsupport.ru/external/2016/01/18.jpg
MarkFL
01-05-2016, 11:29 AM
All I can figure is that the threadbit template for 4.1.x is slightly different than that for 4.2.x, and the str_replace() function I use to modify the templates isn't working as planned. :)
CAG CheechDogg
01-05-2016, 02:40 PM
I got this to work with the manual template edit to the threadbit template, disabled Modify Templates For New Phrase, Username Markup In Threadbit (forumdisplay) and Username Markup In Threadbit (Last Post By) from the plugins and activated Username Markup In Threadbit (search_results) and Username Markup In Threadbit (threadbit) from the manual plugins created ....maybe this will help out ...
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.