pmpro_checkLevelForPayflowCompatibility

Checks if PMPro settings are complete or if there are any errors.

Description

pmpro_checkLevelForPayflowCompatibility( (constant) $level = NULL ); 

Payflow currently does not support: Trial Amounts > 0.

Parameters (1)

0. $level — Optional. (constant) => NULL
The level.

Usage

  1. if ( !function_exists( 'pmpro_checkLevelForPayflowCompatibility' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/adminpages/functions.php'; 
  3.  
  4. // The level. 
  5. $level = NULL; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = pmpro_checkLevelForPayflowCompatibility($level); 
  9.  

Defined (1)

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

/adminpages/functions.php  
  1. function pmpro_checkLevelForPayflowCompatibility($level = NULL) 
  2. $gateway = pmpro_getOption("gateway"); 
  3. if($gateway == "payflowpro") 
  4. global $wpdb; 
  5.  
  6. //check ALL the levels 
  7. if(empty($level)) 
  8. $sqlQuery = "SELECT * FROM $wpdb->pmpro_membership_levelsORDERBY id ASC"; 
  9. $levels = $wpdb->get_results($sqlQuery, OBJECT); 
  10. if(!empty($levels)) 
  11. foreach($levels as $level) 
  12. {  
  13. if(!pmpro_checkLevelForPayflowCompatibility($level)) 
  14. return false; 
  15. else 
  16. //need to look it up? 
  17. if(is_numeric($level)) 
  18. $level = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->pmpro_membership_levels WHERE id = %d LIMIT 1" , $level ) ); 
  19.  
  20. //check this level 
  21. if($level->trial_amount > 0) 
  22. return false; 
  23.  
  24. return true;