<?xml version="1.0"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>Urban Giraffe Support Topic: userpermission parameter for query_posts() function?</title>
<link>http://urbangiraffe.com/support/</link>
<description>Urban Giraffe Support Topic: userpermission parameter for query_posts() function?</description>
<language>en</language>
<pubDate>Thu, 28 Aug 2008 11:23:45 +0000</pubDate>

<item>
<title>John on "userpermission parameter for query_posts() function?"</title>
<link>http://urbangiraffe.com/support/topic/userpermission-parameter-for-query_posts-function#post-152</link>
<pubDate>Sun, 06 Apr 2008 11:43:46 +0000</pubDate>
<dc:creator>John</dc:creator>
<guid isPermaLink="false">152@http://urbangiraffe.com/support/</guid>
<description>&#60;p&#62;I'm surprised you need to add any special code at all as the plugin should hook into the standard WP query function and will remove any posts that you are not allowed to see.  This should mean that whatever method is used to display posts will be affected.  Have you tried it without the extra code?
&#60;/p&#62;</description>
</item>
<item>
<title>fekw on "userpermission parameter for query_posts() function?"</title>
<link>http://urbangiraffe.com/support/topic/userpermission-parameter-for-query_posts-function#post-120</link>
<pubDate>Sat, 29 Mar 2008 14:43:07 +0000</pubDate>
<dc:creator>fekw</dc:creator>
<guid isPermaLink="false">120@http://urbangiraffe.com/support/</guid>
<description>&#60;p&#62;Hi.&#60;/p&#62;
&#60;p&#62;I usually show up 2 posts on my first page. Even if the user is logged in or not.&#60;br /&#62;
So if the user is a non-registered user only posts without any permissions will&#60;br /&#62;
be shown to him.&#60;/p&#62;
&#60;p&#62;In the index.php I use the following code to limit the query to two posts.&#60;/p&#62;
&#60;p&#62;1. without userpermissions)&#60;br /&#62;
  //limit query to show 2 posts on first page&#60;br /&#62;
  query_posts('posts_per_page=2'); &#60;/p&#62;
&#60;p&#62;  //loop&#60;br /&#62;
  if (have_posts()) :&#60;br /&#62;
    while (have_posts()) : the_post();&#60;br /&#62;
    [...]&#60;br /&#62;
    endwhile;&#60;br /&#62;
  [...]&#60;/p&#62;
&#60;p&#62;2. with userpermissions)&#60;br /&#62;
  //limit query to show 2 posts on first page&#60;br /&#62;
  $count=0;&#60;br /&#62;
  global $current_user;&#60;/p&#62;
&#60;p&#62;  //loop&#60;br /&#62;
  if (have_posts()) :&#60;br /&#62;
    while (have_posts()&#38;#38;&#38;#38;$count&#38;lt;=1) : the_post();&#60;br /&#62;
      $permissions = Permissions::get ($post-&#38;gt;ID);&#60;br /&#62;
      if ($permissions-&#38;gt;can_read ($current_user) == true){&#60;br /&#62;
      [...]&#60;br /&#62;
      $count++;&#60;br /&#62;
      };&#60;br /&#62;
    endwhile;&#60;br /&#62;
  [...]&#60;/p&#62;
&#60;p&#62;Question: Is there an easier way as I use in 2.) to get all posts in the query&#60;br /&#62;
with read permissions to the current user? Maybe there's a parameter to add in&#60;br /&#62;
the query_posts() function? So please let me know.&#60;/p&#62;
&#60;p&#62;Thanks in advance.&#60;/p&#62;
&#60;p&#62;Greetings.&#60;br /&#62;
Frank
&#60;/p&#62;</description>
</item>

</channel>
</rss>
