pmpro_page_meta

Require Membership Meta Box.

Description

pmpro_page_meta(); 

Usage

  1. if ( !function_exists( 'pmpro_page_meta' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/metaboxes.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = pmpro_page_meta(); 
  7.  

Defined (1)

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

/includes/metaboxes.php  
  1. function pmpro_page_meta() 
  2. global $membership_levels, $post, $wpdb; 
  3. $page_levels = $wpdb->get_col("SELECT membership_id FROM {$wpdb->pmpro_memberships_pages} WHERE page_id = '{$post->ID}'"); 
  4. ?> 
  5. <ul id="membershipschecklist" class="list:category categorychecklist form-no-clear"> 
  6. <input type="hidden" name="pmpro_noncename" id="pmpro_noncename" value="<?php echo wp_create_nonce( plugin_basename(__FILE__) )?>" /> 
  7. <?php 
  8. $in_member_cat = false; 
  9. foreach($membership_levels as $level) 
  10. ?> 
  11. <li id="membership-level-<?php echo $level->id?>"> 
  12. <label class="selectit"> 
  13. <input id="in-membership-level-<?php echo $level->id?>" type="checkbox" <?php if(in_array($level->id, $page_levels)) { ?>checked="checked"<?php } ?> name="page_levels[]" value="<?php echo $level->id?>" /> 
  14. <?php 
  15. echo $level->name; 
  16. //Check which categories are protected for this level 
  17. $protectedcategories = $wpdb->get_col("SELECT category_id FROM $wpdb->pmpro_memberships_categories WHERE membership_id = $level->id");  
  18. //See if this post is in any of the level's protected categories 
  19. if(in_category($protectedcategories, $post->id)) 
  20. $in_member_cat = true; 
  21. echo ' *'; 
  22. ?> 
  23. </label> 
  24. </li> 
  25. <?php 
  26. ?> 
  27. </ul> 
  28. <?php  
  29. if('post' == get_post_type($post) && $in_member_cat) { ?> 
  30. <p class="pmpro_meta_notice">* <?php _e("This post is already protected for this level because it is within a category that requires membership.", 'paid-memberships-pro' );?></p> 
  31. <?php  
  32.  
  33. ?> 
  34. <?php