• I’m trying to show some content for users, who do not have an active subscription, but have 1 or more posts on the site.

    function show_pay() {
      
    $authorid = 714; //get_current_user_id();
    	query_posts(array( 
        	'post_type' => 'property',
            'author' => $authorid,
            'post_status' => array( 'publish' ),
    ) ); 
         $count = 0;
         	while (have_posts()) : the_post(); 
            	$count++; 
            endwhile;
    wp_reset_query();
    
    $has_sub = wcs_user_has_subscription( '', '', 'active' );
    	
    	if ( !$has_sub && $count >= 1 ) {
    		echo 'Test..';
    	}

    It’s not working, and the text is shown to everyone, even when not logged in on the site. What am I doing wrong?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show content based on active subscription, posts’ is closed to new replies.