Support

Akeeba Backup for WordPress

#20631 Jquery error (not being loaded)

Posted in ‘Akeeba Backup for WordPress’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

WordPress version
n/a
PHP version
n/a
Akeeba Backup version
n/a

Latest post by on Thursday, 11 September 2014 01:20 CDT

OpenGlobal
I'm getting a jquery error when trying to do anything:

ReferenceError: akeeba is not defined
akeeba.jQuery('.hasTooltip').tooltip();

Looking at the page source, the akeeba jquery library is never loaded. It's an old version of WordPress (3.4.1) so maybe it's normally loaded by a process that didn't exist in this old version.

Is there something I should do? What's the best way to manually add the akeeba jquery library to the page?

nicholas
Akeeba Staff
Manager
Yes, the problem is the WordPress version. Nothing earlier than 3.8.1 is supported. Your version of WordPress doesn't load jQuery automatically. However, we are not allowed to load it ourselves as this practice is incompatible with WordPress 3.5 (or 3.6, I am not perfectly sure) and later. That's what we were told when submitting our plugin to WordPress.org's plugins directory.

However, there is a trick to force-load jQuery on these old WP releases. Edit the file wp-content/plugins/akeebabackupwp/helpers/defines.php and append the following line:
define('AKEEBA_OVERRIDE_JQUERY', 1);

Make sure that the files jquery.min.js and jquery.migrate.min.js are present in the directory wp-content/plugins/akeebabackupwp/app/media/js. If they are not present you can download them from jquery.com or just tell me and I'll send them to you.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

OpenGlobal
One other change is needed, then it works perfectly.

In function enqueueScript() in .....plugins/akeebabackupcore/helpers/AkeebaBackupWP.php, you need to change the line:

wp_enqueue_script($handle, $url, array('jquery', 'jquery-migrate'), AKEEBA_VERSION, false);

to

wp_enqueue_script($handle, $url, array(/*'jquery', 'jquery-migrate'*/), AKEEBA_VERSION, false);

nicholas
Akeeba Staff
Manager
Thanks! I changed this line to

		// When we override the loading of jQuery do not depend on WP's jQuery being loaded
		if (defined('AKEEBA_OVERRIDE_JQUERY') && AKEEBA_OVERRIDE_JQUERY)
		{
			$dependencies = array();
		}

		wp_enqueue_script($handle, $url, $dependencies, AKEEBA_VERSION, false);


for the same result, but more elegantly coded. Thank you very much for confirming this workaround. I wrote it blindly, without being able to reproduce the problem, simply assuming this problem would occur based on my experience. Now that this is a confirmed fix I will document it :)

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

OpenGlobal

System Task
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!