Permissions when pulling listings from site
Posted: August 7th, 2010, 10:45 am
Diving back into some customization for my WordPress using MemberPro and hitting a wall. I understand how the conditionals and constants can be used to restrict access to displaying certain pages, etc. But I'm running into an issue when trying to figure out how to restrcit listings of protected items. I've read many of the posts here as well as the docs, but I appear to be missing something.
One aspect of my site is creating an XML listing for an external application (which would be logged into the site via the login mechanism). This would be a list of ids that the application can then build a menu for showing what is available. An example URL the app requests would be:
http://site.com/getListing?catids=13,15,16
The problem is that I don't see a way to determine if a particular post or category is restricted. I've included my php code below, with <<<<----- signifying where I want to do a check.
Any suggestions...and sorry if this is plainly covered somewhere.
If I can pass something on to query_args, I can do this as well -- using something like this:
One aspect of my site is creating an XML listing for an external application (which would be logged into the site via the login mechanism). This would be a list of ids that the application can then build a menu for showing what is available. An example URL the app requests would be:
http://site.com/getListing?catids=13,15,16
The problem is that I don't see a way to determine if a particular post or category is restricted. I've included my php code below, with <<<<----- signifying where I want to do a check.
Any suggestions...and sorry if this is plainly covered somewhere.
- Code: Select all
foreach( $catids as $catID ) {
if (MEMBER CANNNOT ACCESS CATEGORY) continue; <<<<---- check and skip
$args = array( 'posts_per_page' => $numposts, 'cat' => $catID, 'post_type' => array( 'post', 'gallery','ad') );
$my_query = new WP_Query($args);
while ($my_query->have_posts()) : $my_query->the_post();
if (MEMBER CANNNOT ACCESS POST) continue; <<<<---- check and skip
echo $post->ID;
endwhile;
}
If I can pass something on to query_args, I can do this as well -- using something like this:
- Code: Select all
$args = array( 'posts_per_page' => $numposts, 'cat' => $catID);
$my_query = new WP_Query($args);