pmpro_checkLevelForStripeCompatibility

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

Description

pmpro_checkLevelForStripeCompatibility( (constant) $level = NULL ); 

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_levels ORDER BY id ASC"; 
  9. $levels = $wpdb->get_results($sqlQuery, OBJECT); 
  10. if(!empty($levels)) 
  11. foreach($levels as $level) 
  12. /** 
  13. Stripe currently does not support:  
  14. * Billing Limits.  
  15. */ 
  16. if($level->billing_limit > 0) 
  17. return false; 
  18. else 
  19. //need to look it up? 
  20. if(is_numeric($level)) 
  21. $level = $wpdb->get_row("SELECT * FROM $wpdb->pmpro_membership_levels WHERE id = '" . esc_sql($level) . "' LIMIT 1"); 
  22.  
  23. //check this level 
  24. if($level->billing_limit > 0) 
  25. return false; 
  26.  
  27. return true;