vBulletin , vBSEO , PHP , CSS ve Fenerbahçe üzerine tuttuğum kişisel bloğum.
Bu Başlığı Değerlendirin

vBulletin Stil Seçme

Posted 06-06-2007 at 22:00 by Lizard King
Updated 06-09-2007 at 11:54 by Lizard King
vBulletin ne kadar iyi bir program olsada sevmediğim birçok noktası var. Stil seçme de sevmediğim opsiyonlardan bir tanesi. Bir zamanlar kendim farklı bir stil seçme modifikasyonu hazırlamıştım. Ancak o özellik her sayfaya ekstra 1 query yüklemekteydi. Bunu ortadan kaldırmak için yeni modifikasyon hazırlamaya başlamıştım. Çok sevdiğim arkadaşım Floren yardımları sayesinde yeni bir stil seçme opsiyonu hazırladım. Bu opsiyonu yeni stilimiz Blue Ocean'de kullandık. Sağ altta footer'da görebileceğiniz bu özelliği kurmak için aşağıdaki adımları yapmalısınız.

Ilk olarak functions_plugin.php isminde bir dosya oluşturup içine aşağıdaki kodu koyabilirsiniz.
Code:
 userinfo['styleid'], $vbulletin->userinfo['realstyleid']);
    if ($thisstyleid == 0 AND $quickchooser)
    {
        $thisstyleid = $vbulletin->options['styleid'];
    }

    // initialize various vars
    if ($init)
    {
        $stylesetlist = '';
        // set the user's 'real style id'
        if (!isset($vbulletin->userinfo['realstyleid']))
        {
            $vbulletin->userinfo['realstyleid'] = $vbulletin->userinfo['styleid'];
        }

        if (!$quickchooser)
        {
            if ($thisstyleid == 0)
            {
                // 'selected="selected"' becomes 'id="boldstyle"'
                $optionselected = 'id="boldstyle"';
            }
            $optionvalue = 0;
            $optiontitle = $vbphrase['use_forum_default'];
            // template 'option' becomes 'option_custom'
            eval ('$stylesetlist .= "' . fetch_template('option') . '";');
        }
    }

    // check to see that the current styleid exists
    // and workaround a very very odd bug (#2079)
    if (is_array($vbulletin->stylecache["$styleid"]))
    {
        $cache =& $vbulletin->stylecache["$styleid"];
    }
    else if (is_array($vbulletin->stylecache[$styleid]))
    {
        $cache =& $vbulletin->stylecache[$styleid];
    }
    else
    {
        return;
    }

    // loop through the stylecache to get results
    foreach ($cache AS $x)
    {
        foreach ($x AS $style)
        {
            if ($style['userselect'] OR $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'])
            {
                $stylecount++;
                if ($thisstyleid == $style['styleid'])
                {
                    // 'selected="selected"' becomes 'id="boldstyle"'
                    $optionselected = 'id="boldstyle"';
                }
                else
                {
                    $optionselected = '';
                }
                $optionvalue = $style['styleid'];
                $optiontitle = $style['title'];
                // template 'option' becomes 'option_custom'
                eval ('$stylesetlist .= "' . fetch_template('option_custom') . '";');
                $stylesetlist .= construct_custom_style_options($style['styleid'], false, $quickchooser);
            }
            else
            {
                $stylesetlist .= construct_custom_style_options($style['styleid'], false, $quickchooser);
            }
        }
    }

    return $stylesetlist;
}

/*======================================================================*\
|| ####################################################################
|| # SVN: $RCSfile: functions_plugins.php,v $ - $Revision: 1.00 $
|| ####################################################################
\*======================================================================*/
?> 
Daha sonra bu dosyayı forum/includes klasörünüzün içine ftp ile gönderiniz.

Bir sonraki adımda init_startup hookunu kullanarak aşağıdaki yeni plugin'i oluşturun.
Hook Location : init_startup
Plugin Ismi : Style Chooser
Code:
// get plugin core functions

if (!empty($db->explain))

{

	$db->timer_start('Including functions_plugins.php');

	require_once(DIR . '/includes/functions_plugins.php');

	$db->timer_stop(false);

}

else

{

	require_once(DIR . '/includes/functions_plugins.php');

}
Aşağıdaki kodu kullanarak global_start hookuna bir plugin daha ekleyin
Hook Location : global_start
Plugin Ismi : Style Chooser
Code:
// Generate Custom Style Chooser

if ($vbulletin->options['allowchangestyles'] AND empty($_POST['do']))

{

	$stylecount = 0;

	// $quickchooserbits becomes $customchooserbits

	$customchooserbits = construct_custom_style_options(-1, true, true);

	$show['quickchooser'] = ($stylecount > 1 ? true : false);

	unset($stylecount);

}

else

{

	$show['quickchooser'] = false;

}
En son olarak stil bitlerini oluşturmak için yeni bir template yaratıyoruz.
Template Ismi : option_custom
Code:
$optiontitle 
$customchooserbits variable'ını stil seçicinin çıkmasını istediğiniz yere ekleyiniz. Bitlerin görünümünü değiştirmek için template'i istediğiniz gibi düzenleyiniz. Yardım isterseniz mesaj atmaktan çekinmeyin.

vBSEO kullanıcıları eğer template olarak aşağıdakini kullanınız.
Code:
$optiontitle 

Etiket vBulletin , Ayyaş
Görüntüleme 235 Yorumlar 0 Edit Tags Blog Başlığını Email ile Gönder
Toplam Trackbacks 0

Trackbacks