vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Integration with vBulletin - vBShout Customization (https://vborg.vbsupport.ru/showthread.php?t=132287)

jamesk 11-22-2006 10:00 PM

vBShout Customization
 
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']);
}

I removed the "banned user" support (you can leave it in if you wish).

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'));
}

Added 3 "New Plug In"s as:

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

Ronak 11-24-2006 12:51 AM

gud hack but this shud been posted in Template Modifications :)

JamieLee2k 11-24-2006 09:38 AM

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

Calibre_k 11-24-2006 12:21 PM

Would I be able to have this on a forums & sub forums?

bollyzone.net 11-25-2006 06:11 AM

can i see demo plz?

Shazz 11-25-2006 06:46 AM

A screen shot of a demo would be nice :)

JamieLee2k 11-25-2006 01:26 PM

how to install would be nice

Terminatoronly 11-27-2006 06:56 AM

thanks alot working fine with me :)

emmanuel132 12-03-2006 04:44 AM

i dont see install man

wolfyman 12-03-2006 05:29 PM

can anybody tell me how I could use this, but make the shoutbox automatically close at certain hours? Like from 8-midnight?


All times are GMT. The time now is 11:48 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.01040 seconds
  • Memory Usage 1,756KB
  • 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
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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