Thread: End-User Options - Selective Forum Filter
View Single Post
  #66  
Old 01-28-2010, 04:32 PM
Fiel Fiel is offline
 
Join Date: Jul 2008
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Since I've been getting a steady stream of questions regarding the update to vB4, here's how you update to vB4:

The only problem with this hack in vB4 is that it doesn't appear correctly in the UserCP. This is due to vB4 using a new template creation engine (which is much, much easier to use - makes it obvious which variables are available to templates and which are not). As of right now, the templates are using variables that they don't have access to, so it doesn't work. These modifications fixes it to work with vB4:

AdminCP --> Products & Plugins --> Plugin Manager --> "SFF: User Options"

Replace this:

PHP Code:
    else 
    { 
        
$optionselected ''
    } 
    eval(
'$optoutforumbits .= "' fetch_template('option') . '";'); 
}

$find_string '$customfields[other]'
$add_string fetch_template('modifyoptions_excludeforums'); 
$vbulletin->templatecache['modifyoptions'] = str_replace($find_string$find_string $add_string$vbulletin->templatecache['modifyoptions']); 

With this:

PHP Code:
    else 
    { 
        
$optionselected ''
    } 
    
$templater vB_Template::create('option');  
    
$templater->register('optionvalue'$optionvalue);  
    
$templater->register('optiontitle'$optiontitle);  
    
$templater->register('optionclass'$optionclass); 
    
$templater->register('optionselected'$optionselected); 
    
$optoutforumbits .= $templater->render(); 


$templater vB_Template::create('modifyoptions_excludeforums');
$templater->register('optoutforumbits'$optoutforumbits);
$template_hook['usercp_options_other'] .= $templater->render(); 
Make sure you save it.

Then go back into the plugin manager and edit "SFF: Cache Templates". This plugin is trying to access a variable which doesn't exist in vB4.

Change this:

PHP Code:
if (THIS_SCRIPT == 'profile'

    
$globaltemplates array_merge($globaltemplates, array( 
        
'modifyoptions_excludeforums'
    )); 

To this:

PHP Code:
if (THIS_SCRIPT == 'profile')
{
    
$cache array_merge($cache, array(
        
'modifyoptions_excludeforums',
    ));

Now you need to change user options to allow the user to select it. For this hack, the creator included his own template (modifyoptions_excludeforums), but that works with vB3 and needs updating for vB4.

So, go to Styles & Templates --> Style Manager --> YOUR_STYLE_HERE --> "Modify User Template Options" --> "modifyoptions_excludeforums"

Replace the entire template contents with this:

Code:
<div class="blockrow">
        <legend>{vb:rawphrase exclude_forums_title}</legend>
	<p class="description">{vb:rawphrase exclude_forums_desc_1} <br /> <br />{vb:rawphrase exclude_forums_desc_2}</p>
        <div class="group">
	<select style="width: 50%" size="13" name="excludeforumids[]" id="sel_excludeforumids" multiple="multiple">
		<option value="">{vb:rawphrase exclude_none}</option>
		{vb:raw optoutforumbits}
	</select>
        </div>
</div>
And you're done. It should work fine and dandy now.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02760 seconds
  • Memory Usage 1,792KB
  • 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
  • (4)bbcode_php
  • (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