Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
458
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.03 KB | None | 0 0
  1. global $WishListMemberInstance;
  2.  
  3.         $post_id = 107;
  4.  
  5.         // Returns true if PayPerPost is enabled, false if not
  6.         $is_pay_per_post = $WishListMemberInstance->PayPerPost($post_id);
  7.         var_dump($is_pay_per_post);
  8.         echo '<hr>';
  9.  
  10.         // Returns number of people who have purchased post.
  11.         $ContentType = 'posts';
  12.         $post_id = 107;
  13.  
  14.         $wpm_access = array_flip($WishListMemberInstance->GetContentLevels($ContentType, $post_id));
  15.  
  16.         $user_access      = array_keys( $wpm_access );
  17.         foreach ( $user_access AS $key => $user ) {
  18.             if ( substr( $user, 0, 2 ) != 'U-' ) {
  19.                 unset( $user_access[$key] );
  20.             } else {
  21.                 $user = get_userdata( substr( $user, 2 ) );
  22.                 if ( $user ) {
  23.                     $name = trim( $user->user_firstname . ' ' . $user->user_lastname );
  24.                     if ( ! $name ) {
  25.                         $name = $user->user_login;
  26.                     }
  27.                     $user_access[$key] = array(
  28.                         $user->ID,
  29.                         $name,
  30.                         $user->user_login,
  31.                         $user->user_email
  32.                     );
  33.                 } else {
  34.                     unset( $user_access[$key] );
  35.                 }
  36.             }
  37.         }
  38.  
  39.         echo count( $user_access );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement