View Single Post
  #4  
Old 01-12-2015, 12:01 AM
fxdigi-cash fxdigi-cash is offline
 
Join Date: Jul 2012
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks nerbert for sharing the code.

I will give it a try and see if it works.

Cheers

P.s: where and how do I use this code?? as a plugin? if yes, then what hook should I use with??

Quote:
Originally Posted by nerbert View Post
It happens I'm working on an update to a mod that ignores a list of forums. Here's a little code snippet for not listing selected forums:

Code:
		$ignore_array = array(11,12,23,24);    //example of forum id's you don't want to show
		
		$cache = array();
		foreach($vbulletin->forumcache AS $forumcache)
		{
			$i = $forumcache['forumid'];
			if(!in_array($i, $ignore_array))
			{
				$cache[$i] = $forumcache;
			}
		}
		$vbulletin->forumcache = $cache;
--------------- Added [DATE]1421029071[/DATE] at [TIME]1421029071[/TIME] ---------------

Quote:
Originally Posted by kh99 View Post
Well, I'm not sure if I completely understand. But I don't see why you couldn't copy forum.php to another name, then modify it do display only certain forums. It looks like it uses $vbulletin->forumcache, so maybe near the beginning you could delete the forums you don't want to display from $vbulletin->forumcache. You said you don't want to use mods, but it might be possible to do that in a plugin using hook forumhome_start. You could check for a parameter and adjust forumcache accordingly.

But I haven't actually tried this and sometimes you run in to things that don't work like you hoped, as I'm sure you know.
Thanks man, kh99

I wanted to make each forum in an independent page because my forums are a lot and each has many sub-forums. so if I made each set of forums in one page, it will be easier for readers and visitors to understand what's going easily.

ok, if copying forum.php is a lot easier, then what code do I have to change in the new .php file... is it this code:

PHP Code:
foreach ($parentlist AS $forumID)
    {
        
$forumTitle =& $vbulletin->forumcache["$forumID"]['title'];
        
$navbits[fetch_seo_url('forum', array('forumid' => $forumID'title' => $forumTitle))] = $forumTitle;
    } 
HOW?? I have no clue how to start...!!

any idea??
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01789 seconds
  • Memory Usage 1,783KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete