Last active
April 17, 2016 05:20
-
-
Save sybrew/7afeaa7b26bcec3caca5565bb29f23c6 to your computer and use it in GitHub Desktop.
Disables Annoying Pronamic iDeal upgrade nag until you reach 15 purchases.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Pronamic IDEAL Notice Killer | |
* Plugin URI: https://hostmijnpagina.nl/ | |
* Description: Disables Annoying Pronamic iDeal upgrade nag until you reach 15 purchases. | |
* Version: 1.0.0 | |
* Author: Sybre Waaijer | |
* Author URI: https://cyberwire.nl/ | |
* License: GPLv3 | |
*/ | |
add_action( 'admin_notices', 'disable_pronamic_ideal_notification_pre', 10 ); | |
function disable_pronamic_ideal_notification_pre() { | |
if ( pronamic_ideal_is_active() ) { | |
$status = get_option( 'pronamic_pay_license_status' ); | |
temp_store_pronamic_ideal_status( $status ); | |
$almost_there = Pronamic_WP_Pay_Plugin::get_number_payments() > 14 ? true : false; | |
if ( ! $almost_there ) | |
update_option( 'pronamic_pay_license_status', 'valid' ); | |
} | |
} | |
add_action( 'admin_notices', 'disable_pronamic_ideal_notification_pro', 12 ); | |
function disable_pronamic_ideal_notification_pro() { | |
if ( pronamic_ideal_is_active() ) { | |
$status = temp_store_pronamic_ideal_status(); | |
update_option( 'pronamic_pay_license_status', $status ); | |
} | |
} | |
function temp_store_pronamic_ideal_status( $status = '' ) { | |
static $cache = null; | |
if ( '' === $status ) | |
return $cache; | |
$cache = $status; | |
} | |
function pronamic_ideal_is_active() { | |
static $cache = null; | |
if ( isset( $cache ) ) | |
return $cache; | |
if ( method_exists( 'Pronamic_WP_Pay_Plugin', 'get_number_payments' ) ) | |
return $cache = true; | |
return $cache = false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment