Hey there,
Up until now I’ve only used S2M with roles to restricted my content, without the ccap functionalities. In order to show users only the excerpt of a post in a single page, without redirecting them to the membership options page, I’ve bypassed the default restriction with add_filter("ws_plugin__s2member_check_post_level_access_excluded", "__return_true");
in functions.php, and added is_permitted_by_s2member()
conditional in single.php. so my single.php looks like this:
if ( is_permitted_by_s2member() ) {
the_content();
}else{
the_excerpt();
//click to login or register
}
It’s working just fine. Also, I changed one specific post restriction settings from level-1 to level-0 + ccap_0_test
capability. then I created a testing user with level-0 role and manually gave the user ccap_0_test
capability. This user can see the post content - great.
Now - I want also level-1 users to be able to see the post content, so I add ccap_0_test
to the level-1 role, and changed back my testing user to level-1 (also deleted its ccap manually). like this:
function itamar_s2m_add_ccaps() {
// gets the author role
$level_1 = get_role( 's2member_level1' );
$level_1->add_cap( 'ccap_0_test' );
}
add_action( 'admin_init', 'itamar_s2m_add_ccaps');
Now when I login as this user and open that specific post - I only see the excerpt and not the full content.
Any ideas would be appreciated,
Thanks,
Itamar