How to Disable the MultiThumb Plugin on Modules

One of the really annoying plugins that we have to constantly work with is the MultiThumb plugin (or the so-called BK-MultiThumb plugin). It is annoying because we always have to modify the core to make it work the way we want it to work. It is also poorly documented and is characterized by an erratic behavior. (Yes, in case you’re wondering, Joomla plugins can have characters!)

One of the major annoyances with the MultiThumb plugin is its inability to differentiate between actual content and modules, so the code runs on the modules as well, and tries to intelligently (wink, wink) create thumbnails of the images in the modules – which is often not the desired behavior. Unfortunately, the plugin has no setting explicitly instructing it not to work on (certain) modules. To overcome this, the average Joomla administrator adds the mt_ignore directive in the alt tag of each and every image in each and every module that he does not want MultiThumb to modify. Clearly, this is an annoying and a hair pulling task, especially if the number of modules is in the hundreds (which is the case for many of the Joomla websites we work with).

So, are there other solutions for this problem?

Well, fortunately, at itoctopus, we have devised a couple of clean solutions to address this annoyance:

  1. Solution #1 – Instruct the module not to Prepare Content

    Usually, modules affected by the MultiThumb plugin have a setting under Basic Options which is called Prepare Content. When set to “Yes”, Prepare Content will trigger a call the function onContentPrepare when the module is loaded into the website. This means that any plugin (including the MultiThumb plugin) that has the function onContentPrepare will have full access to said module’s content – in other words, the plugin can read and can modify the module’s content. Obviously, if you don’t want your module’s content to be potentially modified, ensure that Prepare Content is set to “No”.

  2. Solution #2 – Modify MultiThumb’s core

    While the first solution is elegant, it suffers from three drawbacks: 1) it is not practical in case the website has hundreds of modules (one has to manually change the value of Prepare Content to “No” in all the modules), 2) some modules may trigger the onContentPrepare function without having a setting to disable it, and 3) setting the onContentPrepare value to “No” may have adverse effects on the website.

    So, a better solution would be to modify MultiThumb‘s core by telling it not to process modules. This can be easily done by adding a line to the following function (the line is highlighted in red, and the function is located in the file multithumb.php which is located under the plugins/content/multithumb folder) :

    public function onContentPrepare($context, &$article, &$params, $limitstart = 0) {
    	if (strpos($context, 'mod_') !== FALSE) return;
    	if ( !$this->is_article ) {
    		return;		
    	}
    	$this->onPrepareContent ( $article, $params, $limitstart);
    }

    Now, nothing’s perfect, and the above solution will mean that MultiThumb will not work on any module (which is most likely what you want). But, what if you want MultiThumb to work on some modules? Well, in this case, you just create a white-list array in the above function, and any modules in that white-list array will be processed by the plugin. Easy, huh?

Of course, the second solution must be performed by someone who knows a thing or two about coding, preferably a programmer. So, if you’re not, or if you need help doing this, then why not contact us? We are always available, our rates are competitive, our work is fast and professional, and we are super friendly!

No comments yet.

Leave a comment