Quantcast
Viewing all articles
Browse latest Browse all 10

vBulletin 4: Disable plugin/mod per style [SOLVED]

Suppose you install a new vBulletin 4 plugin that affects all your styles. For instance, the Subforum maganer plugin I talked about some days ago.

This Subforum manager plugin does NOT work with the mobile style included in vBulletin 4.1.8.

If the mod has an on/off switch, then you can write a plugin to turn off the mod when using styleid xx. You can use the hook location style_fetch for that. If the mod doesn’t have an on/off switch, then you will need to put a condition around the modification plugins themselves to turn them off for styleid xx.

For instance, my mobile styleid is styleid=6 (if I type mysite.com/?styleid=6) I see the mobile theme.

Looking at the XML file for the product I want to disable for mobile style I notice this line which indicates there is indeed an option for activating/desactivating this product, $vbulletin->options['sub_forum_manager']

<stylevardfns>
	</stylevardfns>
	<stylevars>
	</stylevars>
	<plugins>
		<plugin active="1" executionorder="5">
			<title>Sub-forum Manager (FORUMDISPLAY)</title>
			<hookname>forumdisplay_complete</hookname>
			<phpcode><![CDATA[if ( $vbulletin->options['sub_forum_manager'] )

I want to disable the product ‘Hasann – Sub-Forum Manager’ for styleid=6 so I write a new plugin like this:

Product: Hassan - Sub-Forum-Manager
Hook: style_fetch
Title: DisableHassanForMobileStyle
Order: 1
PHP Code:
if ($styleid == 6){
  $vbulletin->options['sub_forum_manager'] = 0;
}
Active plugin: YES

Image may be NSFW.
Clik here to view.

Job done!


Viewing all articles
Browse latest Browse all 10

Trending Articles