Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




Editor can view but not edit admin posts

UserPost

5:26 am
July 8, 2009


maplehill

Member

posts 3

1

I'm getting really close to setting up my site the way it should be for CMS functionality.  However, I've run into a snag and can't seem to work through it. Here are the main settings:

Restrictions/Catergories:
Post Reader    Unrestricted
Private Post Reader    Restricted
Post Contributor    Restricted
Post Author    Restricted
Post Editor    Restricted
Category Manager    Unrestricted

Restrictions/Categories:
Headlines
Post Reader    (Unrestricted by default)
Private Post Reader    (Restricted by default)
Post Contributor    (Restricted by default)
Post Author    (Restricted by default)
Post Editor    (Restricted by default)
Category Manager    (Unrestricted by default)

Roles/Categories:
Headlines
Post Reader   
Private Post Reader   
Post Contributor   
Post Author   
Post Editor    Groups: Updates
Category Manager   

The Updates group includes User A, who is also a WP Editor.  For some reason, User A can view all of the posts but can only edit posts published by non-admins.  User A can only view admin post, not edit or delte them.  The only way I have been able to permit User A to edit admin posts is by elevating User A to an admin.  Obviously, that's not a good solution.  What am I doing wrong?

7:16 am
July 8, 2009


Kevin

Admin

posts 2402

2

maplehill said:

For some reason, User A can view all of the posts but can only edit posts published by non-admins.  User A can only view admin post, not edit or delte them.  The only way I have been able to permit User A to edit admin posts is by elevating User A to an admin.


Something like this has been reported occasionally, and I've never been able to reproduce it. I'll try later this afternoon, but may need ftp access to your role-scoper folder and a sample login to track it down.

8:43 am
July 8, 2009


maplehill

Member

posts 3

3

I just sent you login info via the general contact form.

4:20 pm
July 8, 2009


Kevin

Admin

posts 2402

4

This turns out to be a conflict with the Exec-PHP plugin. It's documented in RoleScoper_PluginCompat.html (installed in plugin folder); I had just forgotten the symptoms. I'm making a mental note to publish such plugin compatibility issues more prominently.

With the login you provided, I took the liberty of editing your Exec-PHP (as described below) to eliminate the conflict .


Exec-PHP:

Recursive has_cap call in Exec-PHP seems to cause problems for other has_cap filters.

Must modify includes/runtime.php as follows:

change:

if (!$poster->has_cap(ExecPhp_CAPABILITY_EXECUTE_ARTICLES))

to:

$exec_articles_cap = ExecPhp_CAPABILITY_EXECUTE_ARTICLES;
if ( empty($poster->allcaps[$exec_articles_cap]) )

5:26 am
July 9, 2009


maplehill

Member

posts 3

5

I guess that's the downfall of using the WP plugin installer instead of manually uploading the files.  I never noticed the RoleScoper_PluginCompat.html file.

Thanks SO much for helping me!

3:42 pm
July 13, 2009


Dorith

New Member

posts 1

6

I am having this same problem, and I did what you said to the Exec-Php file, but it did not solve my problem. What should I do?

2:01 pm
July 21, 2009


Kevin

Admin

posts 2402

7

Dorith said:

I am having this same problem, and I did what you said to the Exec-Php file, but it did not solve my problem. What should I do?


Make sure you changed the line in function filter_user_has_cap. The same line of code also occurs in function filter_user_content, but that one is not the source of RS conflict.

7:33 pm
September 15, 2010


alnitak

Member

posts 3

8

I have PHP EXECUTION plugin installed and am having the same problem where users see the page that they have permission to edit in their page list, but when they click on the page, they get the "you don't have permission to edit this page"

Any ideas?

3:55 pm
October 12, 2010


Kevin

Admin

posts 2402

9

I'll try to take a look at that plugin later this week. It'll probably require something similar to the Exec-PHP workaround cited above.

8:45 pm
October 20, 2010


Kevin

Admin

posts 2402

10

I found that both plugins were contributing to this conflict. The Role Scoper issue (capability requirements applied by other plugins is not reflected in edit link in Edit Posts listing) is now fixed in Role Scoper 1.2.9.RC6 and 1.3.RC6.

The PHP Execution issue and workaround:

As of PHP Execution v1.0.0, the mechanism to limit editing based on post author capabilities is inherently incompatible w/ Role Scoper. Edit php-execution-plugin/includes/class.php_execution.php as follows :

change:

    add_filter('user_has_cap', array(&$this,'action_user_has_cap'),10,3);

to:

    add_filter( 'map_meta_cap', array( &$this,'map_meta_cap' ), 10, 4 );

replace function action_user_has_cap with :

    function map_meta_cap( $caps, $meta_cap, $user_id, $args ) {
        $object_id = ( is_array($args) ) ? $args[0] : $args;
        if ( ! $post = get_post( $object_id ) )
            return $caps;

        if ( function_exists( 'get_post_type_object' ) ) {
            $type_obj = get_post_type_object( $post->post_type );
            $is_edit_cap = ( ( $type_obj->cap->edit_post == $meta_cap ) && in_array( $type_obj->cap->edit_others_posts, $caps ) );
        } else {
            $is_edit_cap = in_array( $meta_cap, array( 'edit_post', 'edit_page' ) ) && array_intersect( $caps, array( 'edit_others_posts', 'edit_others_pages' ) );
        }

        if ( $is_edit_cap ) {
            $id = $post->post_author;

            if ( isset( $this->cap_cache[$id] ) ) {
                $author_can_exec_php = $this->cap_cache[$id];
            } else {
                $author = new WP_User($id);
                $author_can_exec_php = ! empty( $author->allcaps[PHP_EXECUTION_CAPABILITY] );
                $this->cap_cache[$id] = $author_can_exec_php;
            }

            if ( $author_can_exec_php ) 
                $caps []= PHP_EXECUTION_CAPABILITY;
        }

        return $caps;	
    }

9:04 am
October 28, 2010


dabnpits

New Member

posts 1

11

Kevin's post (#4) above with instructions on how to edit Exec-PHP did the trick for me. Running Role Scoper 1.2.7 and Exec-PHP 4.9

Thanks for the help!


About the Agapetry forum

Currently Online:

17 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1186

Posts: 5409

Members:

There are 1176 members

There are 1 guests


Kevin has made 2402 posts

Top Posters:

metal450 - 159

Ragnar - 105

YikYak - 70

whiteorb - 44

Daisy - 35

Administrator: Kevin | Moderators: Kevin