/*
API function for Conditionals.
Allows developers to integrate s2Member ( via Themes ).
Is a specific [Category, Tag, Post, Page, or URI] protected by s2Member?
$__id - optional argument. Defaults to current $post->ID in The Loop.
$__type - optional argument. One of: `category`, `tag`, `post`, `page`, `singular`, `uri`. Defaults to: `singular`.
$check_user - optional ( consider the current User? ) defaults to: false.
*/
if (!function_exists ("is_protected_by_s2member"))
{
function is_protected_by_s2member ($__id = FALSE, $__type = FALSE, $check_user = FALSE)
{
global $post; /* Global reference to $post in The Loop. */
/**/
$__id = ($__id) ? $__id : ( (is_object ($post) && $post->ID) ? $post->ID : false);
$__type = ($__type) ? strtolower ($__type) : "singular";
/**/
if ($__type === "category" && ($array = c_ws_plugin__s2member_catgs_sp::check_specific_catg_level_access ($__id, $check_user)))
return $array; /* A non-empty array with ["s2member_level_req"]. */
/**/
else if ($__type === "tag" && ($array = c_ws_plugin__s2member_ptags_sp::check_specific_ptag_level_access ($__id, $check_user)))
return $array; /* A non-empty array with ["s2member_level_req"]. */
/**/
else if (($__type === "post" || $__type === "singular") && ($array = c_ws_plugin__s2member_posts_sp::check_specific_post_level_access ($__id, $check_user)))
return $array; /* A non-empty array with ["s2member_(level|sp|ccap)_req"]. */
/**/
else if (($__type === "page" || $__type === "singular") && ($array = c_ws_plugin__s2member_pages_sp::check_specific_page_level_access ($__id, $check_user)))
return $array; /* A non-empty array with ["s2member_(level|sp|ccap)_req"]. */
/**/
else if ($__type === "uri" && ($array = c_ws_plugin__s2member_ruris_sp::check_specific_ruri_level_access ($__id, $check_user)))
return $array; /* A non-empty array with ["s2member_level_req"]. */
/**/
return false;
}
}
<?php
$debut = 0; // The first article to be displayed
foreach (get_posts ("numberposts=-1&offset=" . $debut) as $post)
{
if (!is_protected_by_s2member ($post->ID, "singular", true))
{
?>
<a href = "<?php the_permalink(); ?>" rel = "bookmark" title = "<?php the_title(); ?>" class = "postlist"><?php the_title (); ?></a>
<br />
<?php
}
}
?>
Statistics: Posted by Jason Caldwell — April 7th, 2011, 4:53 pm
Statistics: Posted by prema — April 6th, 2011, 1:01 am
Statistics: Posted by Cristián Lávaque — April 5th, 2011, 2:03 pm
<?php
$debut = 0; // The first article to be displayed
$myposts = get_posts('numberposts=-1&offset=$debut');
foreach($myposts as $post) :
$postAccessLevel = ws_plugin__s2member_check_specific_post_level_access($post->ID);
$postLevel = $postAccessLevel['s2member_level_req'];
if($postLevel == 2 || $postLevel == 3 || $postLevel == 4 ){
?> <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>" class="postlist"><?php the_title(); ?></a><br/> <?php
}
endforeach;
?>
Statistics: Posted by prema — April 5th, 2011, 10:27 am