View Full Version : Default Pre-selected Post Icon
JJR512
04-20-2006, 10:00 PM
Here's a simple little hack that allows you, the Admin, to select a particular post icon that will be pre-selected when a member goes to post a new thread or new reply.
This is a bit different from the built-in option, "Show Default Post Icon" in the "Thread Display Options (showthread)" section, which only shows the icon you set if a message doesn't have an icon saved with it. I decided I would rather have a particular icon pre-selected when a member starts a new post, rather than displaying one later if no icon was selected.
This is a simple install: Download the XML file and add it as a product. No template edits, no uploads. That's it! :)
trackpads
04-21-2006, 02:55 PM
Can you have a different one for each forum?
JJR512
04-21-2006, 04:19 PM
Yes you can. I'll show you how. Unfortunately I don't have a lot of time to figure out a more elegant solution, so you're going to have to manually add another plugin and edit the plugin to suit your needs. I'll show you how.
First, in your Admin CP, Plugin System section, go to Add New Plugin. Set the Product to Default Post Icon. Set the hook location to newthread_forum_start. Enter the title as "Default Post Icon (per forum)".
This is the code for the plugin:
if ($foruminfo['forumid'] == '0')
{
$newpost['iconid'] = '1';
}
else if ($foruminfo['forumid'] == '0')
{
$newpost['iconid'] = '1';
}
else
{
$newpost['iconid'] = '';
}
On the first line, change the 0 to the forumid of the forum you want to have a different default post icon. Two lines down, change the 1 to the post icon id you want to be the default for that forum.
If you want another forum to have a different default post icon, then change the next 0 and the next 1 appropriately, the same as you just did.
If you want more forums to have different default post icons, you must COPY the FOUR lines that start with "else if" and past that clump of code above the line that's just "else". Make the appropriate changes to each 0 and 1 (forumid and post icon id).
I hope that makes sense.
(And if you only wanted ONE forum to have a different default post icon, don't worry about the second 0 and 1, leave them as they are; since no forum has a forumid of 0, nothing will happen.)
Boofo
04-21-2006, 04:21 PM
Yes you can. I'll show you how. Unfortunately I don't have a lot of time to figure out a more elegant solution, so you're going to have to manually add another plugin and edit the plugin to suit your needs. I'll show you how.
First, in your Admin CP, Plugin System section, go to Add New Plugin. Set the Product to Default Post Icon. Set the hook location to newthread_forum_start. Enter the title as "Default Post Icon (per forum)".
This is the code for the plugin:
if ($foruminfo['forumid'] == '0')
{
$newpost['iconid'] = '1';
}
else if ($foruminfo['forumid'] == '0')
{
$newpost['iconid'] = '1';
}
else
{
$newpost['iconid'] = '';
}
On the first line, change the 0 to the forumid of the forum you want to have a different default post icon. Two lines down, change the 1 to the post icon id you want to be the default for that forum.
If you want another forum to have a different default post icon, then change the next 0 and the next 1 appropriately, the same as you just did.
If you want more forums to have different default post icons, you must COPY the FOUR lines that start with "else if" and past that clump of code above the line that's just "else". Make the appropriate changes to each 0 and 1 (forumid and post icon id).
I hope that makes sense.
(And if you only wanted ONE forum to have a different default post icon, don't worry about the second 0 and 1, leave them as they are; since no forum has a forumid of 0, nothing will happen.)
You can make a per forum setting for that. ;)
Snake
04-21-2006, 06:18 PM
Thanks, works fine! :)
JJR512
04-23-2006, 04:26 AM
You can make a per forum setting for that. ;)
Yeah, I know...That would be the "more elegant solution" I mentioned I don't have time to figure out how to do. By all means if it's something easy or you know how to do it off the top of your head and could just write it up, please show me, and earn a spot on the Contributor list. :)
I'd suggest to change that code above into:
if ($newpost['iconid'] < 1) {
if ($foruminfo['forumid'] == '0')
{
$newpost['iconid'] = '1';
}
else if ($foruminfo['forumid'] == '0')
{
$newpost['iconid'] = '1';
}
else
{
$newpost['iconid'] = '';
}
}
Otherwise using the "Preview Post" function will switch back to the standard icon even if someone has already selected a totally different one!
marksman1
07-23-2006, 06:00 PM
I did this and used mlx's code above and it is working like a charm. Thanks for the modification.
Only problem is I can not find the place to modify the default post icon. It is not showing up under vbulletin options for me.
double edit: Nevermind I found it. :) I guess I should look harder next time.
Will this work on VB 3.5.3?
way2xtreme
10-23-2006, 02:25 AM
Anybody can make this working with 3.6.1?
Thanks in adv
JohnBee
11-29-2006, 06:33 PM
Is it possible to have the default icon appear for the first post only?
Dream
10-02-2007, 03:32 PM
Thank you for this mod, just what I was looking for.
jim doodle
01-10-2011, 11:33 PM
It's been a while since any one used this mod by the looks of things, I've updated it a little to work with multiple forums where adding each forum as a separate 'If' statement is unthinkable.
Instead i've exploded the string of parantlist which contains a strong of parent forum IDs into an array, and made a conditional from there:
Working Version 3.8.6
$newparentarray= explode(',', $foruminfo[parentlist]);
if (in_array(146, $newparentarray)) {
$newpost['iconid'] = '18';
}
else if (in_array(147, $newparentarray)) {
$newpost['iconid'] = '19';
}
And a little edit on the hook location it is "newthread_form_start" not forum.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.