WordPress.org

Ready to get started?Download WordPress

Forums

Co-Authors Plus
[resolved] Multiple authors can't edit pages (18 posts)

  1. Patrick Daly
    Member
    Posted 2 years ago #

    When multiple authors are assigned to a page only the primary author has editorial access. The functionality works fine for a post.

    I'm fairly certain this is because add_coauthor_cap() is only adding capabilities for the post type.

  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    Thanks for the bug report. If you want a quick fix, the easiest thing to do would be to give whatever role you're interested in the 'edit_others_pages' capability. I'll see if I can prepare a proper fix too.

  3. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    As it turns out, it was a pretty simple fix. The taxonomy used for managing relationships between multiple authors and a post is only registered to the 'post' post type.

    You'll need to register it fo the 'page' post type as well by using this snippet in your theme's functions.php file:

    add_action( 'init', 'cap_register_taxonomy_for_pages' );
    /**
     * Register the taxonomy with pages so the Co-Authors Plus permissions lookup works properly
     */
    function cap_register_taxonomy_for_pages() {
    	register_taxonomy( 'author', 'page' );
    }
  4. Patrick Daly
    Member
    Posted 2 years ago #

    Tried this out and nothing seemed to change. I also tried editing co-authors-plus.php line 79 to:

    register_taxonomy( $this->coauthor_taxonomy, array( 'post', 'page' ), array('hierarchical' => false, 'update_count_callback' => '_update_post_term_count', 'label' => false, 'query_var' => false, 'rewrite' => false, 'sort' => true, 'show_ui' => true ) );
    

    ... no luck either way.

    For further clarification, I've assigned 4 contributors to a single page. Contributors have edit_pages and edit_published_pages capabilities, among others. edit_others_pages isn't a reasonable option for the site I'm running this on.

    Still, only the first listed author is able to edit anything.

  5. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    What other plugins do you have installed?

  6. Patrick Daly
    Member
    Posted 2 years ago #

    I've tested with all plugins deactivated except this one.

    Also, this is a network site.

  7. Patrick Daly
    Member
    Posted 2 years ago #

    You're sure this isn't stemming from add_coauthor_cap() ?

    Even though the post type object is being set as page, post, custom post type, etc. it still looks like its only receiving post capabilities: $post_type_object->cap->edit_post

  8. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    The $post_type_object->cap->edit_post value is "edit_page", so the capabilities are being handled properly (as far as I could tell). I was able to reproduce your issue initially when I didn't register the taxonomy for pages, but then it went away after I did.

  9. jvimolch
    Member
    Posted 2 years ago #

    I have the same issue. Co-authors assigned to pages don't have editing capability. Added the taxonomy code snippet to my functions.php in my Theme, no change though. Turned off all the plugins as well.

    Any ideas how to work around this? Is it necessary to recreate the pages?

  10. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    I'm interested again in fixing this if it's still an issue.

    @Patrick Daly: Make any progress on your end?

  11. Doug
    Member
    Posted 2 years ago #

    I'm presently having this issue.

  12. Doug
    Member
    Posted 2 years ago #

    I tried what you suggested earlier in this thread without success.

  13. lance aligiannis
    Member
    Posted 2 years ago #

    any luck with a page editing fix? yeah, works great for posts!

  14. Doug
    Member
    Posted 2 years ago #

    Ok. It took me a long time, but I figured out what the problem is. Line 833 of co-authors-plus.php checks for the publish_posts capability for already existing posts. The correct capability it ought to be checking is edit_published_posts. Therefore, change the two occurrences of publish_posts to edit_published_posts and it seems to work properly. The modified line will then look like: if ( 'publish' == $post->post_status && ( ! isset( $allcaps[$post_type_object->cap->edit_published_posts] ) || ! $allcaps[$post_type_object->cap->edit_published_posts] ) )

  15. Dave953
    Member
    Posted 2 years ago #

    I stumbled across this shortly after reading this thread. Could this plugin work for you guys? It appears to cover 'page' types:
    http://wordpress.org/extend/plugins/co-authors-plus/

  16. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    Could someone who had this issue give me concrete steps to reproduce? Thanks

  17. Doug
    Member
    Posted 2 years ago #

    A user with ability to edit their own posts but not others couldn't edit if they weren't listed as the first author of a post. Typically their role would be that of Author. I believe by default Authors have the publish_posts capability. I was using the user-role-editor to add customize roles. The publish_posts capability was not granted to Authors and thus a problem.

    If Authors have the publish_posts capability by default this problem won't appear. It only becomes a problem if they don't have the publish_post capability. (The publish_post is for granting/denying permission to publish new posts/pages.) As mentioned, the system was checking the publish_posts capability to allow or deny editing of an already published post. The problem is that this is the wrong capability; the edit_published_posts capability is for allowing/denying permission to edit already published posts.

  18. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    Thanks for your persistence, Doug. I've committed a fix that will be available in v2.6.3

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic