latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

About: Jeremy Michiels

Sorry, I've not written a description yet. I'll get to it soon!


Topics I'm Subscribed To

Viewing topic 1 (of 1 total)
Topic Count Last Reply
Viewing topic 1 (of 1 total)

Topics I've Started

Viewing topic 1 (of 1 total)
Topic Count Last Reply
Viewing topic 1 (of 1 total)

My Latest Replies (From Various Topics)

Viewing 1 replies (of 1 total)
Author Replies
Author Replies
Posted: Monday Jul 9th, 2012 at 3:55 pm #18700

Thanks Eduan. I had looked through all the Advanced Conditionals previously and could not figure it out using the examples provided. However your reply did get me thinking in a different way. I decided to simply add a category labled “Private” and use that coupled with the custom capabilities to create a template page that would should only personal content for the logged in user. Here is the code:


  <?php
     query_posts( $query_string . '&cat=47' ); // gets only posts from the private category (check your id)
     global $more; $more = 0;
     
     if ( have_posts() ) {
         while ( have_posts() ) {
         the_post();
             if ( is_permitted_by_s2member()) {  // only if the user is permitted to view the post will it be displayed
             ....post info here...
             }
          }
     } else {
	  echo '<p>You have no private posts.</p>';
	 }
 ?>
 

The only drawback of this method is that it does not check to see if the user actually has a private post prior to getting into the loop. That is, there could be private posts for other members but not this one. In that case, have_posts will be true and the else element will not display. I’ll have to work on that piece later. Not sure how to get that to work off the bat.

Viewing 1 replies (of 1 total)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.