WordPress.org

Ready to get started?Download WordPress

Forums

Edit Flow
[resolved] Restrict permissions for Editorial Metadata (6 posts)

  1. Nicolas
    Member
    Posted 1 year ago #

    Hi,

    First of all many thanks for this great plugin. The only feature I am missing is the ability to prevent writers to change the information in Editorial Metadata box on 'Edit Post' page.

    Let me explain further, I'm using the Editorial Metadata to assign posts to writers. The Editor creates a new post with a title and some details then assigns this post to a writer and gives him some instructions (using fields 'user' and 'paragraph' in metadata). Writers have the capacity to edit_others_posts so they can find which posts they have to work on in their calendar and start working on them.

    Unfortunately, they can modify the fields from metadata and assign the post to another person. I'd like to restrict permissions and allow only editors or admin to edit this field (or even the whole metadata box)

    Is that something that can be done? I tried to look at the section 'Displays HTML output for Editorial Metadata post meta box' and in editorial-metadata.php but i really don't know how to do it.

    http://wordpress.org/extend/plugins/edit-flow/

  2. Nicolas
    Member
    Posted 1 year ago #

    Also, I have tried remove_meta_boxes() in functions.php without success. It works fine for other boxes like submit or category but doesn't work for featured image and Editorial Metadata

    if (is_admin()) :
    function my_remove_meta_boxes() {
    if( (!current_user_can('administrator')) ){
    remove_meta_box ( 'ef_editorial_meta', 'post', 'side' );
    }
    }
    add_action( 'admin_menu', 'my_remove_meta_boxes' );
    endif;
  3. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    The only feature I am missing is the ability to prevent writers to change the information in Editorial Metadata box on 'Edit Post' page.

    It's not currently possible, but I've filed a Github issue for it..

    Something like this should work to only add it for admins:

    function efx_remove_editorial_metadata() {
    	if ( ! current_user_can( 'manage_options' ) )
    		remove_meta_box( 'ef_editorial_meta', 'post', 'side' );
    }
    add_action( 'add_meta_boxes', 'efx_remove_editorial_metadata', 100 );
  4. Nicolas
    Member
    Posted 1 year ago #

    Hi Daniel,

    Thanks for your reply!
    I found that removing the metadata wasn't the best solution as contributors will need to go back on the calendar (leave the post!) if they want to read again the instructions.

    I have edited the code in editorial-metadata.php as following, in the section 'Save any values in the editorial metadata post meta box' line 454:

    if( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
    			|| $post->post_type == 'post' && !current_user_can( 'publish_posts', $id )
    			|| $post->post_type == 'page' && !current_user_can( 'publish_pages', $id ) ) {
    			return $id;
    		}

    Like that only changes from users that can publish posts are saved.

  5. Nicolas
    Member
    Posted 1 year ago #

    Just for information:
    I realized that using contributors and giving them the capacity to edit_other_posts wasn't that I was looking for. All the posts had the same author (the editor) and writers couldn't filter posts properly on the calendar (as the user filter applies to author and not the custom field 'assign to' I was using) plus I didn't really like the fact they were able to edit posts from other writers.

    By default, wordpress has a lot of options ready to use for authors.

    What I have done is: giving the 'author' status to my writers but removing the capacity to publish (delete_published_posts, edit_published_posts, publish_posts).

    Like that the editor can 'assign' an author through the autor metabox (build in wordpress).
    Writers can only edit their own post and they can filter and see only their posts on the calendar.

    Thanks,
    Nicolas

  6. samjco
    Member
    Posted 1 year ago #

    I think this should be read-only to contributors and Authors.
    And the name change would be Editorial Requirements.

    If would also be nice if this interacted with the editorial comments.

    Just some thoughts.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags