pmpro_checkLevelForStripeCompatibility

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

Description

pmpro_checkLevelForStripeCompatibility( (constant) $level = NULL ); 

Stripe currently does not support: Billing Limits.

Parameters (1)

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

Usage

  1. if ( !function_exists( 'pmpro_checkLevelForStripeCompatibility' ) ) { 
  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_checkLevelForStripeCompatibility($level); 
  9.  

Defined (1)

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

/adminpages/functions.php  
  1. function pmpro_checkLevelForStripeCompatibility($level = NULL) 
  2. $gateway = pmpro_getOption("gateway"); 
  3. if($gateway == "stripe") 
  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. if(!pmpro_checkLevelForStripeCompatibility($level)) 
  13. return false; 
  14. else 
  15. //need to look it up? 
  16. if(is_numeric($level)) 
  17. $level = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->pmpro_membership_levels WHERE id = %d LIMIT 1" , $level ) ); 
  18.  
  19. //check this level 
  20. if($level->billing_limit > 0) 
  21. return false; 
  22.  
  23. return true;