pmpro_check_discount_code

Filter the results of the discount code check.

Description

apply_filters( 'pmpro_check_discount_code', (bool) $okay, (object) $dbcode, (int) $level_id, (string) $code ); 

Parameters (4)

0. $okay (bool)
True if code check is okay or false if there was an error
1. $dbcode (object)
Object containing code data from the database row
2. $level_id (int)
ID of the level the user is checking out for.
3. $code (string)
Discount code string.

Usage

To run the hook, copy the example below.
  1. $okay = apply_filters( 'pmpro_check_discount_code', $okay, $dbcode, $level_id, $code ); 
  2.  
  3. if ( !empty( $okay ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the pmpro_check_discount_code callback 
  2. function filter_pmpro_check_discount_code( $okay, $dbcode, $level_id, $code ) { 
  3. // make filter magic happen here... 
  4. return $okay
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'pmpro_check_discount_code', 'filter_pmpro_check_discount_code', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'pmpro_check_discount_code', 'filter_pmpro_check_discount_code', 10, 4 ); 

Defined (1)

The filter is defined in the following location(s).

/includes/functions.php  
  1. $pmpro_check_discount_code = apply_filters("pmpro_check_discount_code", $okay, $dbcode, $level_id, $code);