Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'init', 'init_no_zero_notifications' );
- function init_no_zero_notifications() {
- add_action( 'affiliates_referral', 'no_zero_notifications', 9 );
- add_action( 'affiliates_updated_referral', 'no_zero_notifications', 9 );
- }
- function no_zero_notifications( $referral_id ) {
- global $wpdb;
- $referrals_table = _affiliates_get_tablename( 'referrals' );
- $amount = $wpdb->get_var( $wpdb->prepare( "SELECT amount FROM $referrals_table WHERE referral_id = %d", $referral_id ) );
- if ( floatval( $amount ) <= 0 ) {
- remove_action( 'affiliates_referral', array( 'Affiliates_Notifications', 'affiliates_referral' ) );
- remove_action( 'affiliates_updated_referral', array( 'Affiliates_Notifications', 'affiliates_updated_referral' ) );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement