How to Upgrade Iptanus File Upload Professional from Version 4.13.1

This article is for anyone running Iptanus File Upload Pro at version 4.13.1 or earlier.

Automatic updates have stopped working on those versions, because WP Updates — the third-party service the plugin used to deliver them — shut down.

From version 4.14.0 onwards the plugin uses a new auto-updater of its own, running on the Iptanus services servers. Upgrading to that version or later brings automatic updates back; here are two ways to get there.

Option 1 — upgrade by hand

1. Sign in to your account on the Iptanus website, find your order and download the latest zip file.

2. On your own site, deactivate and then delete the version you have.

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

That is all. Your configuration is not lost along the way.

Option 2 — install a temporary hook

If you would rather update through the Dashboard as usual, this hook restores the update check long enough to do it:

1. Make sure the plugin Professional version is active.

2. Open the plugin’s Dashboard area, go to the Hooks tab and add a new hook.

3. Give it any title you want.

4. Paste the following into the 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/wordpress-plugins/iptanus-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 the Status to Active and press Save.

6. Go to the Plugins page in the Dashboard and check for updates again. A new version of the plugin is now offered — run the update.

The Plugins page offering a new version of the plugin

7. Once the update is done, deactivate and delete the hook. It has served its purpose.

From then on, automatic updates work as they should.

For more information or technical support, please contact us.

The Iptanus team

Did this solve your problem?

4 discussions

Most recent: July 2021

Questions answered by Iptanus and other users.

  1. I clicked “update now” before I found this article, and plugin seemed to update. It it now at version 4.14.3

    Do I still need to follow upgrade steps?

  2. Keon Billings

    HUH??????? Option 1 – Step 3. Where is the “install” application/link/button/magical item that I am not seeing? Exactly How does one “install” this plugin????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Ask a question

Answered by Iptanus, usually within a working day.

Ask a question

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

Scroll to Top