SHARE
TWEET

Untitled

a guest Jun 18th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3.  * Show a unique message on content restricted for a hidden membership level.
  4.  *
  5.  */
  6. function hidden_level_content_pmpro_text_filter( $text ) {
  7.     global $post;
  8.    
  9.     $access = pmpro_has_membership_access( $post->ID, NULL, true );
  10.     $level_ids = $access[1];
  11.        
  12.     if ( is_array( $level_ids ) && in_array( 9, $level_ids ) ) {
  13.         $text = '<p>The respective Membership Level was currently inactive.</p>';      
  14.     }
  15.  
  16.     return $text;
  17. }
  18. add_filter( 'pmpro_non_member_text_filter', 'hidden_level_content_pmpro_text_filter', 5);
  19. add_filter( 'pmpro_not_logged_in_text_filter', 'hidden_level_content_pmpro_text_filter', 5);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top