Action Since x.x.x uncanny-continuing-education-credits

post_edd_sl_plugin_updater_setup

Fires after the $edd_plugin_data is setup. Fires after Easy Digital Downloads Software Licensing plugin data is set up, providing access to plugin information.

add_action( 'post_edd_sl_plugin_updater_setup', $callback, 10, 1 );

Description

Fires after core Easy Digital Downloads Software Licensing plugin updater data is gathered. Developers can use this hook to modify or extend the plugin update data before it's used by the updater. Access the `$edd_plugin_data` array to perform custom actions.


Usage

add_action( 'post_edd_sl_plugin_updater_setup', 'your_function_name', 10, 1 );

Parameters

$edd_plugin_data (array)
Array of EDD SL plugin data.

Examples

add_action( 'post_edd_sl_plugin_updater_setup', 'my_custom_edd_sl_updater_setup', 10, 1 );

/**
 * Custom function to hook into post_edd_sl_plugin_updater_setup.
 * This example demonstrates how you might modify or log EDD SL plugin data
 * after it has been initialized for an updater.
 *
 * @param array $edd_plugin_data Array of EDD SL plugin data.
 */
function my_custom_edd_sl_updater_setup( $edd_plugin_data ) {

	// Example: Log the plugin data for debugging purposes.
	// In a real-world scenario, you might want to conditionally log based on user roles or specific plugin slugs.
	if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
		error_log( 'EDD SL Plugin Updater Setup Data: ' . print_r( $edd_plugin_data, true ) );
	}

	// Example: Conditionally disable automatic updates for a specific plugin.
	// Let's assume the slug 'my-special-plugin' needs to have updates managed manually.
	$plugin_slug_to_manage = 'my-special-plugin';

	if ( isset( $edd_plugin_data['slug'] ) && $edd_plugin_data['slug'] === $plugin_slug_to_manage ) {
		// This assumes the EDD_SL_Plugin_Updater class has a property
		// that can be modified to disable updates.
		// This is purely illustrative as the actual class structure needs to be known.
		// If the updater class were accessible globally or via a method, you could modify it here.
		// For demonstration, let's imagine a hypothetical scenario where we're storing this decision.

		// A more realistic approach might involve storing this in options or a transient
		// and then using that information later in the update checks.
		// For this example, we'll just show how you'd *identify* the plugin.

		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
			error_log( "Identified '" . $plugin_slug_to_manage . "' for custom update management." );
		}

		// To actually *disable* updates, you would typically need to interact with
		// the EDD Software Licensing update check mechanisms, which might involve
		// filtering the results or disabling the updater's checks before they run.
		// This hook fires *during* the setup of the updater object, so direct modification
		// of the updater object itself might be complex without access to it.
		// A more common approach would be to use `edd_software_licenses_should_update` filter.
	}
}

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

src/includes/EDD_SL_Plugin_Updater.php:63

public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {

		global $edd_plugin_data;

		$this->api_url                  = trailingslashit( $_api_url );
		$this->api_data                 = $_api_data;
		$this->plugin_file              = $_plugin_file;
		$this->name                     = plugin_basename( $_plugin_file );
		$this->slug                     = basename( dirname( $_plugin_file ) );
		$this->version                  = $_api_data['version'];
		$this->wp_override              = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
		$this->beta                     = ! empty( $this->api_data['beta'] ) ? true : false;
		$this->failed_request_cache_key = 'edd_sl_failed_http_' . md5( $this->api_url );

		$edd_plugin_data[ $this->slug ] = $this->api_data;

		/**
		 * Fires after the $edd_plugin_data is setup.
		 *
		 * @since x.x.x
		 *
		 * @param array $edd_plugin_data Array of EDD SL plugin data.
		 */
		do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data );

		// Set up hooks.
		$this->init();
	}

Scroll to Top