This article addresses to all users of WordPress File Upload Pro plugin having version 4.13.1 or earlier.

As you may have noticed, auto-updates of the plugin no longer work. This is because the 3rd party tool, WP Updates, used by the plugin to deliver the updates has stopped working.

As of version 4.14.0 and later, a new auto-updater is used that relies on Iptanus Services Servers.

So here are instructions how to upgrade to the latest version and restore back auto-updates of the plugin. Two options are offered.

Option 1 – Manual Upgrade

Here are instructions how to upgrade manually:

1. Go to Iptanus website, login with your account, locate your order and download the latest version zip file.

2. Go to your website, deactivate and then delete the current version of the plugin.

3. Install the latest version from the zip file and activate it.

That’s it you are done! Note that your configuration will not be lost through this procedure.

Option 2 – Install a “Magic” Hook

Here are instructions how to upgrade using a hook:

1. Make sure the plugin Professional version is active.

2. Go to Dashboard area of the plugin, in Hooks tab and add a new hook.

3. Give it any title you want.

4. Put the following code in Code box:

if ( !class_exists("wfu_plugin_auto_updater") ) {
	class wfu_plugin_auto_updater {
		public $update_path;
		public $plugin_slug;
		public $slug;
		public $request_params;
		public $fallback_info;
		public $transient_prefix;
		function __construct($update_path, $plugin_slug, $request_params, $fallback_info, $transient_prefix, $always_show_plugin_details = true) {
			$this->update_path = $update_path;
			$this->plugin_slug = $plugin_slug;
			list ($t1, $t2) = explode('/', $plugin_slug);
			$this->slug = $t1;
			$this->request_params = $request_params;
			$this->fallback_info = $fallback_info;
			$this->transient_prefix = $transient_prefix;
			add_filter('pre_set_site_transient_update_plugins', array(&$this, 'check_update'));
			add_filter('plugins_api', array(&$this, 'check_info'), 10, 3);
			if ( $always_show_plugin_details )
				add_filter('all_plugins', array(&$this, 'check_slug'), 10, 1);
			//set_transient( 'wfu_update_'.$this->slug, null );
			//set_transient( 'wfu_upgrade_'.$this->slug, null );
		}
		public function check_slug($plugins) {
			foreach ( $plugins as $path => $plugin ) {
				list ($t1, $t2) = explode('/', $path);
				$slug = $t1;
				if ( $slug == $this->slug ) $plugins[$path]['slug'] = $slug;
			}
			return $plugins;
		}
		public function check_info($res, $action, $arg) {
			if( $action != 'plugin_information' ) {
				return false;
			}
			if( $this->slug !== $arg->slug ) {
				return false;
			}
			if( false == $remote = get_transient( $this->transient_prefix . '_update_' . $this->slug ) ) {
				$remote = wp_remote_post($this->update_path, array(
					'timeout' => 10,
					'headers' => array(
						'Accept' => 'application/json'
					),
					'body' => $this->request_params['info']
				));
				if ( !is_wp_error( $remote ) && isset( $remote['response']['code'] ) && $remote['response']['code'] == 200 && !empty( $remote['body'] ) )
					set_transient( $this->transient_prefix . '_update_' . $this->slug, $remote, 43200 );
				else {
					$remote = $this->fallback_info;
					$remote = array ( 'body' => json_encode($remote) );
				}
			}
			if ( ! empty( $remote ) ) {
				$remote = json_decode( $remote['body'] );
				if ( $remote ) {
					$res = new stdClass();
					$res->name = ( isset($remote->info->Name) ? $remote->info->Name : '' );
					$res->slug = $this->slug;
					$res->version = ( isset($remote->info->Version) ? $remote->info->Version : '' );
					$res->tested = ( isset($remote->info->Tested) ? $remote->info->Tested : '' );
					$res->homepage = ( isset($remote->info->PluginURI) ? $remote->info->PluginURI : '' );
					$res->requires = ( isset($remote->info->RequiresWP) ? $remote->info->RequiresWP : '' );
					$res->author = ( isset($remote->info->Author) ? $remote->info->Author : '' );
					$res->author_profile = ( isset($remote->info->AuthorURI) ? $remote->info->AuthorURI : '' );
					$res->download_link = ( isset($remote->info->DownloadURI) ? $remote->info->DownloadURI : '' );
					$res->trunk = ( isset($remote->info->DownloadURI) ? $remote->info->DownloadURI : '' );
					$res->requires_php = ( isset($remote->info->RequiresPHP) ? $remote->info->RequiresPHP : '' );
					$res->last_updated = ( isset($remote->info->LastUpdated) ? $remote->info->LastUpdated : '' );
					if ( isset($remote->sections->Description) ) $res->sections['description'] = $remote->sections->Description;
					if ( isset($remote->sections->Installation) ) $res->sections['installation'] = $remote->sections->Installation;
					if ( isset($remote->sections->Changelog) ) $res->sections['changelog'] = $remote->sections->Changelog;
					if ( isset($remote->sections->Frequently_Asked_Questions) ) $res->sections['faq'] = $remote->sections->Frequently_Asked_Questions;
					if( !empty( $remote->screenshots ) ) {
						$res->sections['screenshots'] = $remote->screenshots;
					}
					if( !empty( $remote->banners ) ) {
						$res->banners["high"] = $remote->banners->High;
						$res->banners["low"] = $remote->banners->Low;
					}
					return $res;
				}

			}
			return false;
		}
		public function check_update($transient) {
			if (empty($transient->checked)) {
				return $transient;
			}
			$current_version = $transient->checked[$this->plugin_slug];
			if( false == $remote = get_transient( $this->transient_prefix . '_upgrade_' . $this->slug ) ) {
				$remote = wp_remote_post($this->update_path, array(
					'timeout' => 10,
					'headers' => array(
						'Accept' => 'application/json'
					),
					'body' => $this->request_params['update']
				));
				if ( !is_wp_error( $remote ) && isset( $remote['response']['code'] ) && $remote['response']['code'] == 200 && !empty( $remote['body'] ) )
					set_transient( $this->transient_prefix . '_upgrade_' . $this->slug, $remote, 43200 );

			}
			if ( !is_wp_error( $remote ) && isset( $remote['response']['code'] ) && $remote['response']['code'] == 200 && !empty( $remote['body'] ) ) {
				$remote = json_decode( $remote['body'] );
				if ( $remote && version_compare($current_version, $remote->version, '<') ) {
					$obj = new stdClass();
					$obj->slug = $this->slug;
					$obj->plugin = $this->plugin_slug;
					$obj->new_version = $remote->version;
					$obj->package = $remote->url;
					$transient->response[$this->plugin_slug] = $obj;
				}
			}
			return $transient;
		}
	}
}
if (!function_exists('wfu_plugin_info_attach')) {
	function wfu_plugin_info_attach() {
		if ( defined('WPFILEUPLOAD_PLUGINFILE') ) {
			$plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
			$update_path = ( $plugin_options["altserver"] == "1" && trim(WFU_VAR("WFU_ALT_IPTANUS_SERVER")) != "" ? trim(WFU_VAR("WFU_ALT_IPTANUS_SERVER")).'/g79xo30q8s' : WFU_SERVICES_SERVER_URL.'/wp-admin/admin-ajax.php' );
			$plugin_slug = 'wordpress-file-upload-pro/wordpress_file_upload.php';
			$hash = WFU_VERSION_HASH;
		}
		else {
			$update_path = 'https://services2.iptanus.com/wp-admin/admin-ajax.php';
			$plugin_slug = 'wordpress-file-upload-pro/wordpress_file_upload.php';
			$hash = '9npWpXMhAQ5e6AGJ5zqbaPxLk9ePD3eSu3WKeN9p89E9wmgL2PHtrqXPzBVpStzh';
		}
		$request_params = array(
			'info' => array(
				'action' => 'wfuca_get_plugin_info',
				'version_hash' => $hash
			),
			'update' => array(
				'action' => 'wfuca_get_plugin_update',
				'version_hash' => $hash
			)
		);
		$fallback_info = array(
			'info' => array(
				'Name' => 'Wordpress File Upload Pro',
				'PluginURI' => 'https://www.iptanus.com/support/wordpress-file-upload',
				'RequiresPHP' => ''
			),
			'sections' => array(
				'Description' => 'An error occurred while reading plugin information from <strong>Iptanus Server</strong>. Please try again in a few minutes.<br /><br />If the error persists please contact the administrator at <strong>info@iptanus.com</strong>.'
			)
		);
		new wfu_plugin_auto_updater($update_path, $plugin_slug, $request_params, $fallback_info, 'wfu');
	}
	add_action('init', 'wfu_plugin_info_attach');
}

5. Set Status to Active and Save.

6. Go to Plugins page in Dashboard and check again for updates. You will see that a new version of the plugin is available. Do the update.

7. After the update deactivate and delete the hook. You will not need it anymore.

Please note that after you upgrade to the latest version auto-updates will be restored and get back to normal.

For additional information or technical support, do not hesitate to contact us.

The Iptanus Team

How to Upgrade WordPress File Upload Professional

7 thoughts on “How to Upgrade WordPress File Upload Professional

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.