Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global $WishListMemberInstance;
- $post_id = 107;
- // Returns true if PayPerPost is enabled, false if not
- $is_pay_per_post = $WishListMemberInstance->PayPerPost($post_id);
- var_dump($is_pay_per_post);
- echo '<hr>';
- // Returns number of people who have purchased post.
- $ContentType = 'posts';
- $post_id = 107;
- $wpm_access = array_flip($WishListMemberInstance->GetContentLevels($ContentType, $post_id));
- $user_access = array_keys( $wpm_access );
- foreach ( $user_access AS $key => $user ) {
- if ( substr( $user, 0, 2 ) != 'U-' ) {
- unset( $user_access[$key] );
- } else {
- $user = get_userdata( substr( $user, 2 ) );
- if ( $user ) {
- $name = trim( $user->user_firstname . ' ' . $user->user_lastname );
- if ( ! $name ) {
- $name = $user->user_login;
- }
- $user_access[$key] = array(
- $user->ID,
- $name,
- $user->user_login,
- $user->user_email
- );
- } else {
- unset( $user_access[$key] );
- }
- }
- }
- echo count( $user_access );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement