Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




how to restrict reading to 2 or more cumulative groups

UserPost

10:11 am
April 16, 2011


j2l

Member

posts 4

1

Hi role scopers gurus!,

I'd like to have some posts readable only by members of 2 or more roles, how to do this?

example :

post1 is readable by role1 and role2.

user1 is member of role1 (only) so, in my case, he shouldn't read post1.

user2 is member of role1 and role2 so she can read post1.

in this scenario role 1 is NOT more or less than role2 (like in admin-author WP roles).

I tried with categories and tags but users cannot be members of categories or tags, right?

Thanks,

4:57 am
April 19, 2011


Kevin

Admin

posts 2503

2

Requiring two different role assignments (or group memberships) is not supported. There is no simple workaround, since Role Scoper is designed to filter access based on assignment of a single qualifying role. The "scoping" is recognition of a qualifying role from site-wide, term-specific or object-specific assignment.

6:21 am
April 19, 2011


j2l

Member

posts 4

3

Thanks Kevin

hmm, I see

I also tried with parent pages and was thinking that group inheritance could be interpreted as an AND, not an OR.

if parent page is not visible by user, child page should check this fact and block user whatever access it has.

Do you see a way or setting to tell role scoper to look at parent and interpret as an AND?


12:32 pm
April 19, 2011


Kevin

Admin

posts 2503

4

In your page.php template code, you could retrieve the current page parent and intercept the page display if current_user_can( 'read_page', $post->post_parent ) is false.

But I can't currently offer any such automatic tweaking in the filtering of the Pages listing or Nav Menu.

7:11 am
April 20, 2011


j2l

Member

posts 4

5

Thanks again Kevin,

I really appreciate your help.

I'm not a coder, would you please indicate me what exactly and where in the template I should add your idea?

Here's buddypress template I use :


<?php do_action( 'bp_before_blog_page' ) ?>


<div class="page" id="blog-page">


<?php if (have_posts()) : while (have_posts()) : the_post(); ?>


<h2 class="pagetitle"><?php the_title(); ?></h2>


<div class="post" id="post-<?php the_ID(); ?>">


<div class="entry">


<?php the_content( __( '<p class="serif">Read the rest of this page &rarr;</p>', 'buddypress' ) ); ?>


<?php wp_link_pages( array( 'before' => __( '<p><strong>Pages:</strong> ', 'buddypress' ), 'after' => '</p>', 'next_or_number' => 'number')); ?>

<?php edit_post_link( __( 'Edit this entry.', 'buddypress' ), '<p>', '</p>'); ?>


</div>


</div>


<?php endwhile; endif; ?>


</div><!– .page –>


<?php do_action( 'bp_after_blog_page' ) ?>


5:08 am
April 21, 2011


j2l

Member

posts 4

6

Hello again,

I found how to do it, it was pretty easy, no need to take me by the hand :)

Sorry for being so dummy,

thanks a lot Kevin


About the Agapetry forum

Currently Online:

10 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1247

Posts: 5656

Members:

There are 1259 members

There are 1 guests


Kevin has made 2503 posts

Top Posters:

metal450 - 178

Ragnar - 108

YikYak - 70

whiteorb - 49

Daisy - 35

Administrator: Kevin | Moderators: Kevin