pmpro_getMembershipCategories

Pmpro_getMembershipCategories() returns the categories for a given level.

Description

pmpro_getMembershipCategories( $level_id ); 

$level_id is a valid membership level ID

Return values: Success returns boolean true. Failure returns boolean false.

Parameters (1)

0. $level_id
The level id.

Usage

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

Defined (1)

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

/includes/functions.php  
  1. function pmpro_getMembershipCategories($level_id) 
  2. $level_id = intval($level_id); 
  3.  
  4. global $wpdb; 
  5. $categories = $wpdb->get_col("SELECT c.category_id 
  6. FROM {$wpdb->pmpro_memberships_categories} AS c 
  7. WHERE c.membership_id = '" . $level_id . "'"); 
  8.  
  9. return $categories;