Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




How to programmatically set scope on a new post?

UserPost

10:38 am
July 28, 2009


timt

New Member

posts 1

1

I am developing a new plugin, in which I generate new posts (based upon user input generated from an html form) using the WordPress wp_insert_post API call.   I would like to also set up the role_scoper permissions on this new post automatically, so that only specific Groups of users are Readers of the post.

I tried writing new entries to the wp_user2role2object_rs and wp_role_scope_rs tables to achieve this, but this doesn't seem to be enough.  I also tried calling scoper_flush_restriction_cache to clear anything in the cache relating to the new post, but that didn't help.

Does anyone have any suggestions of how I can achieve this?

7:13 am
August 1, 2009


Kevin

Admin

posts 2503

2

timt said:

I would like to also set up the role_scoper permissions on this new post automatically, so that only specific Groups of users are Readers of the post.

I tried writing new entries to the wp_user2role2object_rs and wp_role_scope_rs tables to achieve this, but this doesn't seem to be enough. 


Did you create the desired restrictions / roles manually and then confirm that your code is inserting equivalent entries? You shouldn't need to modify anything else (aside from flushing the cache as you mentioned. Of course you can always manually flush or disable the cache if you suspect that your own cache-flushing call is faulty.


About the Agapetry forum

Currently Online:

13 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