1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Convert vBulletin Blog Categories into Global Categories.

Discussion in 'Content Management System' started by shabbir, Sep 30, 2008.

  1. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83

    Introduction



    I just purchased new vBulletin blog and as always its very well coded but I guess when I any forum owner buys vBulletin blog his

    aim is not to create an individual blog but make it Global Blog for the forums. At least I had such a requirement and so here is

    an hack to do it. I am posting it here because I have not seen any hacks for the blog.

    Background



    I have created it such that every one has access to only categories created by me i.e. userid = 1 and if you would like this to

    be different from 1 make changes accordingly in the code changes below.

    First import the product using Admin CP > Plugins& Products > Manage Products > Add Import product . Also this involves

    additional code as well as template changes and so I would list them here.

    File : /includes/blog_functions.php
    Find
    PHP:
        $cats $vbulletin->db->query_read_slave("
            SELECT blog_category.*
            FROM " 
    TABLE_PREFIX "blog_category AS blog_category
            WHERE userid = 
    $userid
            ORDER BY displayorder
        "
    Comment the above and replace it with the below one.
    PHP:
        $cats $vbulletin->db->query_read_slave("
            SELECT blog_category.*
            FROM " 
    TABLE_PREFIX "blog_category AS blog_category
            WHERE userid = 1
            ORDER BY displayorder
        "
    Find
    PHP:
    function &build_overview_sidebar($month 0$year 0)
    {
        global 
    $vbulletin$show$stylevar$vbphrase$vbcollapse;
    Add the global variable $sidebar to the list.
    PHP:
    function &build_overview_sidebar($month 0$year 0)
    {
        global 
    $vbulletin$show$stylevar$vbphrase$vbcollapse$sidebar;
    File : blog.php
    Find

    PHP:
    else if (!empty($_REQUEST['userid']) OR !empty($_REQUEST['u']) OR !empty($_REQUEST['username']))
    and replace with
    PHP:
    else if (!empty($_REQUEST['userid']) OR !empty($_REQUEST['u']) OR !empty($_REQUEST['username']) OR !empty($_REQUEST['blogcategoryid']))
    In short add the following condition
    PHP:
    OR !empty($_REQUEST['blogcategoryid'])
    Now add the following lines into the blog_sidebar_generic template
    HTML:
    	<if condition="$sidebar['categorybits']">
    		<div class="tborder" style="margin-top:$stylevar[cellpadding]px; padding:$stylevar[cellspacing]px">
    			<div class="thead" style="padding:$stylevar[cellpadding]px">
    				<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('blog_categories')"><img id="collapseimg_blog_categories" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_blog_categories].gif" alt="" border="0" /></a>
    				$vbphrase[blog_categories]
    			</div>
    			<div class="alt1 smallfont" style="padding:$stylevar[cellpadding]px; margin-top:$stylevar[cellspacing]px; $vbcollapse[collapseobj_blog_categories]" id="collapseobj_blog_categories">
    				<ul style="list-style:none; padding:0px; margin:0px">$sidebar[categorybits]</ul>
    			</div>
    		</div>
    	</if>
    
    If you would like your user not to be able to add new categories

    File : blog_usercp.php
    Find
    PHP:
    if ($_POST['do'] == 'updatecat')
    {
    and below that add
    PHP:
        // Edit the user id to the userid who should be able to create the categories. This is same id for which you are fetching the categories
        
    if($vbulletin->userinfo['userid'] != 1
        {
            
    print_no_permission();
        }
    All done
     

    Attached Files:

  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    Just forgot to mention that you can see the working example of it at www.mbaguys.net
     
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
  4. seoblogcentral01

    seoblogcentral01 Banned

    Joined:
    May 9, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Friends,
    Its wonderful concept as well as very essential for vbulletin blog users.Its good news for all vbulletin forum users and we are waiting for next build release. sure.. this upgrade will control the spam users and will give the best look and feel option.


    Thanks,
     
    Last edited by a moderator: May 9, 2009
  5. lovesorrow1102

    lovesorrow1102 New Member

    Joined:
    Aug 19, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Thank you for providing us with the example code, and a brief explanation of the problem. However, we do not fully understand the problem you are experiencing.:(
     

Share This Page