The Arcive of vBulletin Modifications Site. |
|
![]() |
|||||||||||||||||||||||||
I wanted to have vBShout on just certain "community" pages, namely: index.php (aka FORUMHOME), forumdisplay.php, showthread.php and showpost.php while not displaying on the remaining pages.
In order to do this I modified the code in vBShout [Template Alteration] to: Code:
$Used = 0; $UsedArr = array(); $smilies = $db->query_read(" SELECT smilieid, smilietext, smiliepath, smilie.title, imagecategory.title AS category FROM " . TABLE_PREFIX . "smilie AS smilie LEFT JOIN " . TABLE_PREFIX . "imagecategory AS imagecategory USING(imagecategoryid) ORDER BY imagecategory.displayorder, smilie.displayorder "); $Smilie_Build = ''; $Total_Smilies = $db->num_rows($smilies); if ($Total_Smilies > 0) { while ($emo = $db->fetch_array($smilies)) { if ($vbulletin->options['shout_smilies_show'] > 0) { $Smilie_Cache[] = $emo; } else { $Smilie_Build .= '<a href="#" onclick="return sb_Smilie(\''.$emo['smilietext'].'\')"><img src="'.$emo['smiliepath'].'" alt="'.$emo['title'].'" border="0" /></a> '; } } if ($vbulletin->options['shout_smilies_show'] > $Total_Smilies) { $vbulletin->options['shout_smilies_show'] = $Total_Smilies; } if ($vbulletin->options['shout_smilies_show'] > 0) { while ($Used < $vbulletin->options['shout_smilies_show']) { $GetEmo = $Total_Smilies; $GetEmo = rand(0, $GetEmo); if (!in_array($GetEmo, $UsedArr) && $Smilie_Cache[$GetEmo]) { $Used++; $GetEmo = $Smilie_Cache[$GetEmo]; $Smilie_Build .= '<a href="#" onclick="return sb_Smilie(\''.$GetEmo['smilietext'].'\')"><img src="'.$GetEmo['smiliepath'].'" alt="'.$GetEmo['title'].'" border="0" /></a> '; } } } } else { $Smilie_Build = 'No Emoticons Available'; } $Options_DropDown = array(); // Items included will be parsed to create drop down menus $DropDowns = array(); // Completed constructed drop down menus $Options_DropDown['font_selector'] = array('Default', 'Arial', 'Arial Black', 'Arial Narrow', 'Book Antiqua', 'Century Gothic', 'Comic Sans MS', 'Courier New', 'Fixedsys', 'Franklin Gothic Medium', 'Garamond', 'Georgia', 'Impact', 'Lucida Console', 'Lucida Sans Unicode', 'Microsoft Sans Serif', 'Palatino Linotype', 'System', 'Tahoma', 'Times New Roman', 'Trebuchet MS', 'Verdana'); $Options_DropDown['color_selector'] = array(); $Options_DropDown['color_selector'][] = 'Default'; $hex = array(); $hex[] = '0'; $hex[] = '3'; $hex[] = '6'; $hex[] = '9'; $hex[] = 'C'; $hex[] = 'F'; for ($a = 0; $a < 6; $a++) { for ($b = 0; $b < 6; $b++) { for ($c = 0; $c < 6; $c++) { $Options_DropDown['color_selector'][] = '#' . $hex[$a].$hex[$a].$hex[$b].$hex[$b].$hex[$c].$hex[$c]; } } } if (is_array($Options_DropDown)) { foreach ($Options_DropDown as $Menu => $Options) { $DropDowns[$Menu] = ''; if (is_array($Options)) { foreach ($Options as $Selection) { if (preg_match("#^\#([a-z0-9]+)$#i", $Selection)) { $Extra = ' style="color:'.$Selection.';"'; } else { $Extra = ''; } if ($Selection == 'Default') { $Text = (($Menu == 'color_selector') ? 'Color' : 'Font Face') . ' [Default]'; } else { $Text = $Selection; } $DropDowns[$Menu] .= '<option value="'.$Selection.'"'.$Extra.'>'.$Text.'</option>' . "\n"; } } } } #function isBanned($user) #{ # return (isBanned_Check($user['userid'], 'shout_banned_users') || isBanned_Check($user['usergroupid'], 'shout_banned_usergroups')); #} #function isBanned_Check($bash, $against) #{ # global $vbulletin; # return in_array($bash, iif($vbulletin->options[$against], explode(',', $vbulletin->options[$against]), array())); #} #if ($vbulletin->options['shout_banned_perms'] == 2 && isBanned($vbulletin->userinfo)) #{ # $Shoutox = ''; #} #else #{ eval('$Shoutbox = "' . fetch_template('forumhome_vbshout') . '";'); #} switch ($vbulletin->options['shout_position']) { case 1: $Position = '<!-- what\'s going on box -->'; break; case 2: $Position = '<!-- end what\'s going on box -->'; break; case 4: $Position = '<!-- main -->'; break; default: $Position = '$navbar'; break; } if (THIS_SCRIPT == "index") { $vbulletin->templatecache['FORUMHOME'] = str_replace($Position, $Position . ' $Shoutbox', $vbulletin->templatecache['FORUMHOME']); } if (THIS_SCRIPT == "forumdisplay") { $vbulletin->templatecache['FORUMDISPLAY'] = str_replace('$navbar', '$navbar' . ' $Shoutbox', $vbulletin->templatecache['FORUMDISPLAY']); } if (THIS_SCRIPT == "showthread") { $vbulletin->templatecache['SHOWTHREAD'] = str_replace('$navbar', '$navbar' . ' $Shoutbox', $vbulletin->templatecache['SHOWTHREAD']); } if (THIS_SCRIPT == "showpost") { $vbulletin->templatecache['SHOWTHREAD_SHOWPOST'] = str_replace('$navbar', '$navbar' . ' $Shoutbox', $vbulletin->templatecache['SHOWTHREAD_SHOWPOST']); } Assumption: for pages other than FORUMHOME it will display under the navbar (no options coded into this code). you can still "move" the index page's positioning. Needs a better method of determining where to insert the vBShout template into the vbulletin page templates. modified the code in vBShout [Template Cache] to: Code:
if (THIS_SCRIPT == "index" | THIS_SCRIPT == "forumdisplay" | THIS_SCRIPT == "showthread" | THIS_SCRIPT == "showpost") { global $globaltemplates; $globaltemplates = array_merge($globaltemplates, array('forumhome_vbshout')); } vBShout [forumdisplay alteration] with hook being forumdisplay_complete vBShout [showpost alteration] with hook being showpost_complete vBShout [showthread alteration] with hook being showthread_complete the code for each being the first code pasted exactly the same into each. now the vBShout shoutbox displays on any page of these 4 types and nowhere else. I am certain this could be "hacked" further and better. so, please, easy with the flame posts. ![]() Show Your Support
|
Comments |
#2
|
||||
|
||||
![]()
gud hack but this shud been posted in Template Modifications
![]() |
#3
|
||||
|
||||
![]()
I really think you need to explain this better, I wouldn't know where to start, what to edit?, where to edit?
This hack is very useful to me. Thanks JamieLee2k |
#4
|
|||
|
|||
![]()
Would I be able to have this on a forums & sub forums?
|
#5
|
|||
|
|||
![]()
can i see demo plz?
|
#6
|
||||
|
||||
![]()
A screen shot of a demo would be nice
![]() |
#7
|
||||
|
||||
![]()
how to install would be nice
|
#8
|
||||
|
||||
![]()
thanks alot working fine with me
![]() |
#9
|
|||
|
|||
![]()
i dont see install man
|
#10
|
||||
|
||||
![]()
can anybody tell me how I could use this, but make the shoutbox automatically close at certain hours? Like from 8-midnight?
|
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|