Les Arbres Web Solutions

Ajax Errors

There is a bug in the Google Analytics plugin by Peter Bui that causes Ajax errors in several of our extensions. The bug causes this error in Joomla, which corrupts the response expected by the Javascript:

Error 0, Call to a member function getType() on null at line 64 of .... /plugins/system/GoogleAnalytics/GoogleAnalytics.php

The error occurs when a request includes the URL parameter "format=raw", as typically used in Ajax requests.

This bug has been affecting users of FlexiContact Plus and Rentalot Plus for many months. We have contacted the author but have not received a response. Other users have also contacted the author without success, so we are providing a fixed version here.

The fix is very simple. We just added a single line at the start of the onAfterRender() function:

	function onAfterRender()
	{
		$this->document = JFactory::getDocument();	// Fix added by Les Arbres Design
		if ($this->app->isClient('administrator') || $this->document->getType() != 'html') {
			return;
		}

You can either apply the fix to the author's official release yourself, or download our fixed version below.

Version 5.01