Back to vBulletin 3.0 Add-Ons

Set and change Post Icon path by styleset or by forum
Mod Version: 1.00, by Michael Morris

This modification is in the archives.
vB Version: 3.0.3 Rating: (0 vote - 0 average) Installs: 3
Released: 27 Oct 2004 Last Update: Never Downloads: 1
Not Supported  

This modification principly works through templates, but you also need to write some code into your PHPINCLUDE_START template. What it does is make the path to your post icons swapable by styleset or by forum. However many alternate post icon sets you create make SURE they all have the same # of icons with the same names or this won't work. It's also recommended you create a default icons and put it in every post icon set.

A total of 5 template modifications are required as well as changes in your post icon settings.

STEP 1: EDIT TEMPLATES.

EDITPOST

Search for:
HTML Code:
<td><img id="display_posticon" src="$selectedicon[src]" alt="$selectedicon[alt]" /></td>
Replace with
HTML Code:
<td><img id="display_posticon" src="$stylevar[post_icon_path]/$selectedicon[src]" alt="$selectedicon[alt]" /></td>

THREADBIT

Search for:
HTML Code:
<td class="alt2"><if condition="$show['threadicon']"><img src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" /><else />&nbsp;</if></td>
Replace with
HTML Code:
<td class="alt2"><if condition="$show['threadicon']"><img src="$stylevar[post_icon_path]/$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" /><else />&nbsp;</if></td>

POSTICONBIT

Search for:
HTML Code:
<td width="12%"><label for="rb_iconid_$iconid"><img src="$iconpath" alt="$alttext" id="pi_$iconid" onclick="rb_iconid_$iconid.click()" /></label></td>
Replace with
HTML Code:
<td width="12%"><label for="rb_iconid_$iconid"><img src="$stylevar[post_icon_path]/$iconpath" alt="$alttext" id="pi_$iconid" onclick="rb_iconid_$iconid.click()" /></label></td>

POSTBIT and POSTBIT_LEGACY (Same code and replacement in each)

Search for:
HTML Code:
<if condition="$show['messageicon']"><img class="inlineimg" src="$post[iconpath]" alt="$post[icontitle]" border="0" /></if>
Replace with:
HTML Code:
<if condition="$show['messageicon']"><img class="inlineimg" src="$stylevar[post_icon_path]/$post[iconpath]" alt="$post[icontitle]" border="0" /></if>

STEP 2: EDIT POST ICON PATHS

1. Open your post icon editor.
2. Delete the path information for every post icon - leave only the image's name. This will break the path to the image for the editor so you want be able to review it in the admincp unless you hack the icon editor file.
3. Go to vboptions >> Thread Display Options (showthread)
4. Strip the path to the default icon, again leave only the file name.

STEP 3: CODING THE PHPINCLUDE_START TEMPLATE.

Ok, easy parts over. Now comes the fun part. You need to define $stylevar['post_icon_path']. If you went to the effort to do this you presumably want it's definition to change by styleset or by forum. The first part is to merge the new stylevar in with the other stylevars. Put the following code at the very start of your PHPINCLUDE_START template.

PHP Code:
$stylevar array_merge($stylevar,
[
'post_icon_path']
); 
Changing by styleset is easy enough - just define it in the PHPINCLUDE_START of that particular style. Here's how.

PHP Code:
$stylevar['post_icon_path'] = 'DIRECTORY CONTAINING YOUR POST ICONS FOR THIS STYLE'
It's recommended that you nest your alternate post icon sets under the /images/icons directory. For Example:

/images/icons/style1

Don't put an ending / character on the path.

Now, if you want to have forums have specific sets you'll need to do the following conditional:

PHP Code:
if ($foruminfo['forumid'] == X)
{
$stylevar['post_icon_path'] = 'DIRECTORY';
}
else
{
$stylevar['post_icon_path'] = 'DEFAULT_DIRECTORY';

X is the id# of the forum that has the special set.

If you want multiple forums to have the same set you'll either need a conditional for each one or use an in_array call.

PHP Code:
$special_forums = array('X''Y''Z');
if (
in_array($foruminfo['forumid'], $special_forums))
{
$stylevar['post_icon_path'] = 'DIRECTORY';
}
else
{
$stylevar['post_icon_path'] = 'DEFAULT_DIRECTORY';

X, Y, and Z are your forum #'s. You can have as many or as few as you like.

And that concludes the "hack." If you find it useful, please click install. I'm vain, I'll admit it.

Download

No files for download.


vblts.ru supports vBulletin®, 2022-2024