• Resolved dsals

    (@dsals)


    Thank you for a wonderful plugin.

    I would love to be able to assign editors to posts, and to have those editors show up as a column in the post table just like authors, sortable in the same fashion. It’s important for us to be able to track which articles specific editors have been working on. I’m guessing others have this need as well.

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

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author cojennin

    (@comradefuzz)

    Sorry this is a bit late. Interesting idea. It seems like this could be partially solved by making an Editorial Metadata of a “user” type and call it something like “Editor Assigned:.” The only issue would be getting it to show up on the posts table. I believe some simple tweaking with the manage_posts_custom_columns action should do it, but I don’t know for sure. I’ll try putting something together to see if I can get it to work.

    Thread Starter dsals

    (@dsals)

    Awesome, thanks. It’s just something on my wish list. I tried to do it myself but kept breaking things 🙂

    Plugin Author cojennin

    (@comradefuzz)

    Ok, so this works for me when inserted into my “functions.php” file in my theme. To clarify, I called my editorial metadata “Working on”, and gave it a type of “user.” That’s why I’m looking for a post_meta called “_ef_editorial_meta_user_working-on”. The “_ef_editorial_meta” is prepended for editorial metadata as post meta being inserted into the database. The “_user” is another string prepended because I selected a type of “user”, and then “working-on” is just the name of my editorial meta data (uncapitalized and spaces replaced with dashes Ninja Edit: It might actually be the slug that’s being appended, not just the name decapitalized and dashes removed. I’ll double check). To double check, just save a post with the meta data of your choice and look at the database to see how it’s been saved. But is should save along the lines of the formula above.

    I could not for the life of me figure out where the sortable_columns filter is applied. I’m still trying to hunt it down just cause I’m curious, but it works at making it sortable. I called my column “Editor,” which you’ll see in the add_editor_columns function.

    Feel free to post back here if you’re having problems or if the code needs more ‘splainin.

    // Getting metadata to show up on posts table
    add_action( 'manage_posts_custom_column' , 'ef_custom_column', 10, 2 );
    
    function ef_custom_column($column, $post_id) {
    	if( $column == 'editor' ) {
    		$user_id = (int)get_post_meta($post_id, '_ef_editorial_meta_user_working-on', true );
    		$editor = get_user_by('id', $user_id);
    		echo $editor->user_nicename;
    	}
    }
    
    add_filter('manage_post_posts_columns' , 'add_editor_columns');
    
    function add_editor_columns($columns) {
        return array_merge($columns,
                  array('editor' => __('Editor')));
    }
    
    add_filter( 'manage_edit-post_sortable_columns', 'make_editor_sortable' );
    
    function make_editor_sortable($columns) {
    	$columns['editor'] = 'editor';
    	return $columns;
    }
    Plugin Contributor Daniel Bachhuber

    (@danielbachhuber)

    There’s an easier way. Make the editorial metadata “visible” and it will be automatically added to the Manage Posts list table (or any list table for posts its enabled for).

    Plugin Author cojennin

    (@comradefuzz)

    Ha. And that would make it a lot easier.

    Plugin Author cojennin

    (@comradefuzz)

    But it doesn’t make it sortable.

    Plugin Author cojennin

    (@comradefuzz)

    So I guess just cut out everything except the sortable filter.

    Plugin Contributor Daniel Bachhuber

    (@danielbachhuber)

    I don’t think you want it sortable, but rather filterable (and that should happen automatically).

    Thread Starter dsals

    (@dsals)

    Filterable would also be fine. I was thinking sortable originally so that I could scan the whole list. But I don’t mind clicking on an editor’s name (or I will leave in the sorting code — thanks fuzz).

    So — sillyish question — how do I “Make the editorial metadata ‘visible'”?

    Plugin Author cojennin

    (@comradefuzz)

    When you create or edit Editorial Metadata, there should be a drop-down near the bottom labeled “Viewable.” Just need to select “Yes.”

    Thread Starter dsals

    (@dsals)

    Wow. Super easy. Thank you both so much for your time and help!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘New feature request: editors’ is closed to new replies.