Class Name:

MP_CORE_Theme_Updater

Purpose:

To keep themes up to date when new versions are released.

Overview:

This class will check if there are new versions available for a theme from a custom repository such as EDD Software Licensing or the MP Repo plugin.When a new version becomes available, it will display a notice on the updates page of WordPress and allow the user to automatically install the update.

It also works for either free or licensed themes. If it is a paid/licensed theme, it will give the user a place to input their license and only check for new updates if the license is valid.

Notes:

This class is designed to be used in conjunction with the MP Repo and Easy Digital Downloads plugins being installed on an external URL. From there, it will serve up the updates.

Usage:

 new MP_CORE_Theme_Updater($args);

Parameters:

$args (array)

Sample Code:

function myplugin_update() {
	$args = array(
		$args = array(
			'software_name' => 'My Theme', //<- The name of this theme in the style.css file, mp_repo, and edd. 
			'software_api_url' => 'http://repo.moveplugins.com/',//The URL where EDD and mp_repo are installed
			'software_licensed' => true, //<-Boolean
		);
	);

	$my_plugin_updater = new MP_CORE_Plugin_Updater($args);
}

add_action( 'init', 'myplugin_update' );

Args:

  • software_name (string) - The exact name of this theme. This should also be set up with the same name in the MP Repo plugin on your API URL and in EDD
  • software_api_url (string) - The URL where MP Repo and EDD are installed.
  • software_licensed (boolean) - If true, the user must have a valid license. If false, the theme updates will be free and check without a license.