| 1 |
<?php |
| 2 |
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); |
| 3 |
|
| 4 |
add_action( 'update_option_' . Imagify_Options::get_instance()->get_option_name(), 'imagify_maybe_delete_partner_on_option_update', 10, 2 ); |
| 5 |
/** |
| 6 |
* After the first API key has been successfully added, make sure the partner ID is deleted. |
| 7 |
* |
| 8 |
* @since 1.6.14 |
| 9 |
* @author Grégory Viguier |
| 10 |
* |
| 11 |
* @param mixed $old_value The old option value. |
| 12 |
* @param mixed $new_value The new option value. |
| 13 |
*/ |
| 14 |
function imagify_maybe_delete_partner_on_option_update( $old_value, $new_value ) { |
| 15 |
if ( empty( $old_value['api_key'] ) && ! empty( $new_value['api_key'] ) ) { |
| 16 |
imagify_delete_partner(); |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
add_action( 'update_site_option_' . Imagify_Options::get_instance()->get_option_name(), 'imagify_maybe_delete_partner_on_network_option_update', 10, 3 ); |
| 21 |
/** |
| 22 |
* After the first API key has been successfully added to the network option, make sure the partner ID is deleted. |
| 23 |
* |
| 24 |
* @since 1.6.14 |
| 25 |
* @author Grégory Viguier |
| 26 |
* |
| 27 |
* @param string $option Name of the network option. |
| 28 |
* @param mixed $new_value The new network option value. |
| 29 |
* @param mixed $old_value The old network option value. |
| 30 |
*/ |
| 31 |
function imagify_maybe_delete_partner_on_network_option_update( $option, $new_value, $old_value ) { |
| 32 |
imagify_maybe_delete_partner_on_option_update( $old_value, $new_value ); |
| 33 |
} |
| 34 |
|