Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




Can't restrict access for taxonomies

UserPost

12:43 am
March 22, 2011


untanglemyweb

Member

posts 6

1
Hi Kevin,
I'd like to lock down the view access of taxonomies for a specific role. I want it to work in a way so that when a category under that taxonomy is locked, users with no access can't view the category as well as the posts that assigned to it.
I can achieve this for the wordpress post category by adding restrictions on Post Reader to Administrators only, see screenshot: http://screencast.com/t/2V8UkB3rM2. However I don't seem to have options for the to lock down the Reader access, see screenshot: http://screencast.com/t/HvCPHlaWh.
Can you point me to the right direction?
Thanks,
Cassie 

6:27 am
March 22, 2011


Kevin

Admin

posts 2503

2

Those screenshots are Role assignments, which increase access (for a specific post/category) beyond what a user's WP role grants. You need to set Restrictions (Restrictions > Category), which reduce access for a specific post/category.

1:40 pm
March 22, 2011


Kevin

Admin

posts 2503

3

The absence of Post roles in your custom taxonomy role admin form (Roles > Catalogs) is probably due to the associated custom post type being registered too late. Your plugin or template code should specify early execution like this:

add_action( 'init', 'my_custom_post_types', 1 );

If that's not possible, you can force Role Scoper to load later by adding this to wp-config.php, above the "stop editing" line:

define( 'SCOPER_LATE_INIT', true );

5:14 pm
March 22, 2011


untanglemyweb

Member

posts 6

4

Hi Kevin,

I added the linedefine( 'SCOPER_LATE_INIT', true ); to wp-config.phpto wp-config.php but it didn't make any difference.  I still can't see the Post roles in Catalogs.

We use GD Custom Posts And Taxonomies Tools to managing custom post types and taxonomies. Do you know where I should add the following line? I don't know which file I'm looking for.add_action( 'init', 'my_custom_post_types', 1 );

Interesting enough I can secure the Post roles for a custom post type on its own, and the issue only seems to happen for those the Post roles with respect for a taxonomy (Catalog in this case).

Thanks,
Cassie 

7:45 pm
March 22, 2011


Kevin

Admin

posts 2503

5

My test installation behaves like that if:

  • the GD custom taxonomy definition specifies a custom post type
  • the corresponding GD custom post type definition does not specify taxonomy

So never mind the code review… this is probably just a config issue for you.

8:04 pm
March 22, 2011


untanglemyweb

Member

posts 6

6

You are a genius Kevin!

I removed the associated taxonomies under that post type definition and it's fixed now.

Thanks heaps!

8:30 pm
March 22, 2011


Kevin

Admin

posts 2503

7

Oh, that's odd. I meant that mine doesn't show the cpt roles in Roles > Categories if the taxonomies are not associated in post type definition.

Maybe you had the association set in the GD type definition but something disabled in Roles > Options > Realm.

10:18 pm
March 22, 2011


untanglemyweb

Member

posts 6

8

Umm, dissociating Catalog under Tutorial (post type) is the only way I can get the those Role options to show up: http://screencast.com/t/sZp5zhDhcFM. This is my configuration under Roles > Options > Realm: http://screencast.com/t/6coFixl9. It looks fine to me.

Would it help if I give you access to our website? If so, do you have an email address for us to send those details to?

Another point I've noticed here is that the taxonomy restrictions does not work if "Teaser" is enabled for the corresponding custom post type. It seems to work in such way that if teaser is enabled, all of the Tutorial links are visible to public regardless of the restrictions of Catalog. Does the teasing override the restrictions set on taxonomies?

If that is the case, it means we cannot use RS to both control taxonomies and show teaser content. How would you achieve this?

Cheers,
Cassie 

1:09 pm
March 23, 2011


Kevin

Admin

posts 2503

9

untanglemyweb said:

Umm, dissociating  [the Catalog taxonomy in the Tutorial post type configuration] is the only way I can get the those Role options to show up


This stemmed from a minor WordPress bug. I have modified the Role Scoper development version (1.3.29-dev) to work around it for now.

4:14 am
March 24, 2011


untanglemyweb

Member

posts 6

10

Hi Kevin,

Reply to your previous points (thought it might be useful posting them here as well): 
1. As you mentioned earlier, the way I associated the custom post type with the taxonomy in GD plugin to work with RS is weird. Can you double check this in the RS settings?
This was ultimately due to a WordPress bug.  The updated Role Scoper dev code works around it to support the expected GD configuration.
- I can confirm after I upgraded to Role Scoper development version (1.3.29-dev),  everything works like a charm. You are A STAR!!
2. I added skip_teaser = 1 argument to the taxonomy array (wp_list_categories() in this case), it does the trick in a way that those locked terms disappeared from the list however I can still access them by browsing to the term link. Is there any way to also lock down those links?
I'm not sure what you mean by browsing to the term link.  If you manually access the category URL, doesn't that just result in the same teaser output that you have in the regular posts listing?
- Sorry for not making our points clear. Ideally what we want to achieve with "Teaser" is:
a) To be able to enable "Teaser" option on a per taxonomy term bases. Right now you can only do this for post types. So we can lock down the tutorials under a particular Catalog term completely (no teasing) while showing teasing content for tutorials under other Catalog terms.
b) To be able to add different teaser text for anonymous users and logged in users. Currently we can only either show the text for anonymous or logged in users or show the same text for both. It would be great to allow us to differentiate the text based on their login status.
Would you be considering implementing those points for any of the near future releases? 

3. The most pressing issue we are currently trying to solve is how we can hook into the RS functions directly in our php code so that we can check a user's permissions and display different content based on whether they are:
a) public
b) member but no access
c) members with access

- The code you provided works perfectly. From my understanding, those are the internal WP hooks?
Again, great great plugin and great great help from you Kevin!
I've just posted a 5 star on your wp plugin page too :) Loving it!
Cheers,
Cassie

3:06 am
April 17, 2011


Pyrobon

New Member

posts 1

11

Kevin said:

The absence of Post roles in your custom taxonomy role admin form (Roles > Catalogs) is probably due to the associated custom post type being registered too late. Your plugin or template code should specify early execution like this:

add_action( 'init', 'my_custom_post_types', 1 );

If that's not possible, you can force Role Scoper to load later by adding this to wp-config.php, above the "stop editing" line:

define( 'SCOPER_LATE_INIT', true );

I'm kinda in shock right now XD I have days trying to figure why in my Reviews theme (ReviewIt), the custom taxonomies weren't showing up in the admin menu under roles and restriction. 
I don't know why i didn't think in your forum, which is actually pretty active. I tried this suggestion and BAM! Worked as a charmed.
Just had to register to thank you for the wonderful plugin and support =) 


About the Agapetry forum

Currently Online:

14 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1245

Posts: 5653

Members:

There are 1255 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