| User | Post |
|
4:03 pm July 1, 2010
| nich008
New Member
| | | |
|
| posts 1 |
|
|
Role Scoper looks so comprehensive I'm sure it can do it, but I can't see how..
I need to restrict people that register on a site to only be able to create a certain custom post type.
Can Role Scoper do this?
John
|
|
|
7:18 am July 13, 2010
| Kevin
Admin
| | | |
|
| posts 1385 |
|
|
I just published Role Scoper 1.2.8.beta to wordpress.org (see "other versions"). It should allow you to do so as follows:
1. User in question should have a WP role of Subscriber
2. Go to Roles > Options > Realm and activate RS filtering of your custom post type
3. Go to Roles > General and assign the desired type-specific role to your user(s), or to the [WP Subscriber] group.
There may be remaining glitches with custom post types in the RS 1.2 code base. Let me know if any of them are killers and maybe I can backport more code from my version 1.3 development. In general, I've found that with custom post types here to stay, requiring WP 3.0 is my only sane approach to manageable code. So RS 1.3 will introduce that requirement along with code that's optimized for it.
|
|
|
6:36 am July 14, 2010
| Worthstream
Member
| | | |
|
| posts 4 |
|
|
Thanks
|
|
|
4:08 am July 18, 2010
| casben79
Member
| | | |
|
| posts 3 |
|
|
Hi Kevin, Brilliant plugin, but I believe I have found a killer in 1.2.8 beta
While logged in as a scoped user while visiting a page with a list of custom post_type posts or attempting to log out i get the following errors:
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in path/to/plugins/plugins/role-scoper/scoped-user.php on line 371
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in path/to/plugins/plugins/role-scoper/scoped-user.php on line 371
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in path/to/plugins/plugins/role-scoper/scoped-user.php on line 371
any advice/hacks/updates I can do to get this to work would be greatly appreciated.
Ill Play around with the settings a little to see where I end up and post here again if I come up with anything interesting.
I'm a developer myself so please dont be afraid to talk code to me.
Cheers
Ben
|
|
|
5:17 am July 18, 2010
| casben79
Member
| | | |
|
| posts 3 |
|
|
It seems no matter what happens, I cannot change this effect, real killer for me,
I did a print_r of some of the variables at that point, if you want the txt file id be happy to send it to you, assuming that all will be sorted with the release of 1.3 sounds awesome, any idea on a rough release date?
Cheers
Ben
|
|
|
6:23 am July 19, 2010
| Kevin
Admin
| | | |
|
| posts 1385 |
|
|
casben79 said:
While logged in as a scoped user while visiting a page with a list of custom post_type posts or attempting to log out i get the following errors:
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in path/to/plugins/plugins/role-scoper/scoped-user.php on line 371
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in path/to/plugins/plugins/role-scoper/scoped-user.php on line 371
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in path/to/plugins/plugins/role-scoper/scoped-user.php on line 371
Is there some reason that user doesn't have any regular site-wide capabilities from their WP role?
What if you change the line in question to:
$this->allcaps = ( is_array($this->allcaps) ) ? array_merge($this->allcaps, $scoper->role_defs->role_caps[$role_handle]) : $scoper->role_defs->role_caps[$role_handle];
How do I recreate your "page with a list of custom post_type posts" ?
What is the WP role and RS roles of the user in question? What restrictions have you set?
|
|
|
11:46 am July 19, 2010
| Kevin
Admin
| | | |
|
| posts 1385 |
|
|
Here's a further revision of that function to try:
function merge_scoped_blogcaps() {
global $scoper;
foreach( array_keys($this->assigned_blog_roles[ANY_CONTENT_DATE_RS]) as $role_handle ) {
if ( ! is_array($scoper->role_defs->role_caps[$role_handle]) )
continue;
$role_spec = scoper_explode_role_handle($role_handle);
if ( ! empty($role_spec->role_type) && ( 'rs' == $role_spec->role_type )
&& $scoper->role_defs->is_member($role_handle) )
$this->allcaps = ( is_array($this->allcaps) ) ?
array_merge($this->allcaps, $scoper->role_defs->role_caps[$role_handle]) :
$scoper->role_defs->role_caps[$role_handle];
}
$this->allcaps['is_scoped_user'] = true;
}
|
|
|
10:53 pm July 22, 2010
| Kevin
Admin
| | | |
|
| posts 1385 |
|
|
The above code patch is included in the RS code base as of version 1.2.8 beta 2
|
|
|
9:42 am July 28, 2010
| lucianosb
Member
| | Belém | |
|
| posts 3 |
|
|
Thanks for the plugin! Takes some time to learn all, but it is great. Now, regarding that option for Custom Post Types, I found out it won' t work with the http://www.wpeasyposttypes.com/ plugin (Another great option towards using WP as CMS). When I go to enable the Post Types on the Realm tab, they just show up disable still when the page reloads.
Might it be due to the "No other plugin or theme shall define function wp_set_current_user() or function set_current_user()." issue mentioned on the Plugin page? For I haven't found anywhere on EPT the calls for these functions yet…
Are there any workarounds for this?
|
|
|
1:10 pm July 28, 2010
| Kevin
Admin
| | | |
|
| posts 1385 |
|
|
I haven't tried that plugin yet, but from a quick look at its code I'm guessing the conflict could be fixed by modifying easy-post-types/custom-type.php as follows:
change:
add_action('init', array($this, 'init' ));
to:
add_action('init', array($this, 'init', 1 ));
add_action('init', array($this, 'init'), 1 );
Let me know if that allows Role Scoper to utilize the custom post types defined by EPT.
|
|
|
11:07 am July 29, 2010
| lucianosb
Member
| | Belém | |
|
| posts 3 |
|
|
It did not work still. WP echoes an error message on Admin and on view side like this:
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Array' was given in /home2/sbvirtua/public_html/crn7/wp-includes/plugin.php on line 395
Then all the Post Types were gone!
Guess I'll have to manually create the custom Post Types, then.
|
|
|
11:55 am July 29, 2010
| Kevin
Admin
| | | |
|
| posts 1385 |
|
|
sorry… typo in my code snippet. It should be:
add_action('init', array($this, 'init'), 1 );
|
|
|
1:27 pm July 29, 2010
| lucianosb
Member
| | Belém | |
|
| posts 3 |
|
|