WordPress.org

Ready to get started?Download WordPress

Forums

Edit Flow
A pool of assignments that authors can call dibs on? (21 posts)

  1. clarklab
    Member
    Posted 2 years ago #

    I'm looking for a way for admins and editors to create a pool of assignments unassigned to any author, until an author comes along and calls 'dibs' on the post. I guess it's someone close to the 'pitch' custom status you've got, but it still isn't quite the same because pitches start with an author selected.

    Also, for bonus points, I would love the ability to set how many 'dibs' each author got during a given period of time.

    We've mostly got straight assignments figured out (when an author is decided ahead of time) and when the authors have their own ideas (calling 'dibs' on a random topic), but we've got no solution for an ongoing pool of assignments that we'd like our authors to write.

    Ideas?

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

  2. mcstevem
    Member
    Posted 2 years ago #

    If you're willing to let authors edit_others_posts, you could create a new user called Unassigned, assign your pool of wannabe stories to that user, and then let you authors filter the calendar or story budget to see Unassigned's posts. They could stake their claim simply by editing a post to assign it to themselves.

  3. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    I think mcstevem's solution would work best for now, although I'm intrigued by what this functionality might look like. If you want, feel free to prepare a couple wireframes of how you think it might work.

  4. clarklab
    Member
    Posted 2 years ago #

    Yeah that was the solution I thought of at first, but I just know that at some point we'd screw up and send a post out authored by 'Unassigned'. That would be easily fixed by just checking for that name should it ever make it in my templates and replacing with 'Staff', but I think in the long run I'd much rather have a more robust system.

    I'd loooove to draw up some wireframes that shows what I'm after. I've got a few other ideas I'd like to see in Edit Flow, care if I toss them in? Or should I make new threads?

    Some background on me: I run http://androidandme.com. We've got about 8 authors, 2 story editors, and 1 copy editor. We post about 8 times per day.

  5. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    Sure, put them on this thread. I'd love to see wireframes, even if to just get the discussion started.

  6. clarklab
    Member
    Posted 2 years ago #

    Here are the quick mockups. Basically it's just another post status, with an extra options screen for controlling how often authors can call dibs.

    http://clarklab.com/wp-content/uploads/2012/02/edit-flow-pool.png

    http://clarklab.com/wp-content/uploads/2012/02/edit-flow-pool-setting.png

    I think this flow would be really useful for us, as our editors and admins are usually the best at creating a good headline, inserting an appropriate post image, etc. I think if the admins could line up a bunch of posts with some post details already perfected we'd see an explosion of targeted content out of our authors (something that currently takes a lot of planning and emails).

    We're in the middle of a shift in content strategy and having some sort of pool would make the process much smoother.

    For now, I'll probably just give it a shot with a shell user called 'Unassigned', like you guys suggested.

  7. Ryan Imel
    Member
    Posted 2 years ago #

    I really like that pool idea. This is something we would use a ton if it were available.

  8. moepstar
    Member
    Posted 2 years ago #

    Actually, this is what i thought the Pitch status would enable me to do - so, yes, a +1 from me :)

  9. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    I like this idea too... mockups convey it well.

  10. obsessedwithfilm
    Member
    Posted 2 years ago #

    I was also hoping this feature would be part of the "Pitch" status, so it's definitely something we'd love to see.

    Every morning I would envisage loading up a bunch of "pitch" article titles, and then our reporters would "claim" and write them. Once a post had been "claimed", it would be their article (e.g. another author couldn't just steam in and change the author name - which the solution offered at the start of this thread would mean).

  11. mogmismo
    Member
    Posted 2 years ago #

    I'm loving the direction of this. We've tried to use assignment desk (now defunct) w/ edit-flow to get this feature set, but it never worked right.

    A bonus feature that I would really like to see is for each thing in the pool to have the ability to be claimed (dibs) by a certain number of people from each role. So the story takes 1 photographer, 1 reporter and 1 editor, all three can claim dibs on it, then it becomes a post.

  12. thatwastaxing
    Member
    Posted 2 years ago #

    Definitely +1

    My site's flow works similar to clarklabs: "editors and admins are usually the best at creating a good headline, inserting an appropriate post image, etc"

  13. ballhogjoni
    Member
    Posted 1 year ago #

    +1 has this been added/worked on? If not has anyone found a work around?

  14. ivnus
    Member
    Posted 1 year ago #

    +1 I would love to see this feature!

    Would be great to allow the author that claims the post to add a co-author after claiming.

  15. ballhogjoni
    Member
    Posted 1 year ago #

    I got your hook up :) Maybe someone can polish it up! You will need to add the capability, assign_pitch_posts.

    in the functions.php file add

    /* Add custom actions in the posts view
     *
     */
    function add_claim_to_pitch_posts_rows($actions, $post_id) {
      $post = get_post($post_id);
      if ( $post->post_status == "pitch" && current_user_can( 'assign_pitch_posts' ) ) {
        unset( $actions['view'] );
        $actions['assign'] = '<a href="http://domain.com/wp-admin/assign.php?post='.$post->ID.'&action=assign" title="' . esc_attr( __( 'Claim this pitch' ) ) . '">' . __( 'Claim' ) . '</a>';
      }
      return $actions;
    }
    add_filter('post_row_actions','add_claim_to_pitch_posts_rows');
    
    function add_unassign_to_posts_rows($actions, $post_id) {
      $post = get_post($post_id);
      if ( $post->post_status == "assigned" && current_user_can( 'assign_pitch_posts' ) && current_user_can( 'edit_post', $post->ID ) ) {
        $actions['assign'] = '<script>function unClaim_'.$post->ID.'()'.
    '{ var r = confirm("Are you sure you want to unclaim this post?\n You will lose all work done on the article.");'.
    'if (r==true){ window.location.href = "http://domain.com/wp-admin/assign.php?post='.$post->ID.'&action=unassign";'.
    '}}</script><a href="javascript:void(0)" onclick="unClaim_'.$post->ID.'()" title="' . esc_attr( __( 'Unclaim this post' ) ) . '">' . __( 'Unclaim' ) . '</a>';
      }
      return $actions;
    }
    add_filter('post_row_actions','add_unassign_to_posts_rows');

    Create a file called assign.php in the wp-admin folder and add this to the file:

    <?php
    /**
     * Assign post to writer.
     *
     */
    
    /** WordPress Administration Bootstrap */
    require_once('./admin.php');
    
    if ( isset( $_GET['post'] ) )
     	$post_id = $post_ID = (int) $_GET['post'];
    elseif ( isset( $_POST['post_ID'] ) )
     	$post_id = $post_ID = (int) $_POST['post_ID'];
    else
     	$post_id = $post_ID = 0;
    
    $post = $post_type = $post_type_object = null;
    
    if ( $post_id )
    	$post = get_post( $post_id );
    
    if ( $post ) {
    	$post_type = $post->post_type;
    	$post_type_object = get_post_type_object( $post_type );
    }
    
    if ( empty( $post_id ) ) {
      wp_redirect( admin_url('post.php') );
      exit();
    }
    
    $p = $post_id;
    
    if ( empty($post->ID) )
      wp_die( __('You attempted to modify an item that doesn’t exist. Perhaps it was deleted?') );
    
    if ( null == $post_type_object )
      wp_die( __('Unknown post type.') );
    
    if ( 'trash' == $post->post_status )
      wp_die( __('You can’t assign this item because it is in the Trash. Please restore it and try again.') );
    
    switch($_GET['action']) {
      case 'assign':
        if ( !current_user_can('assign_pitch_posts') )
          wp_die( __('You are not allowed to assign this item.') );
    
        if ( $post->post_status == "pitch" ) {
          $wpdb->query(
    	"
    	UPDATE $wpdb->posts
    	SET post_status = 'assigned', post_author = " . wp_get_current_user()->ID . "
    	WHERE ID = $p AND post_status = 'pitch'
    	");
        }
        wp_redirect( admin_url('edit.php?post_status=pitch&post_type=post') );
        exit();
        break;
    
      case 'unassign':
        if ( !current_user_can('assign_pitch_posts') )
          wp_die( __('You are not allowed to unassign this item.') );
    
        if ( $post->post_status == "assigned" ) {
          $wpdb->query(
    	"
    	UPDATE $wpdb->posts
    	SET post_status = 'pitch', post_author = 159
    	WHERE ID = $p AND post_status = 'assigned'
    	");
        }
        wp_redirect( admin_url('post.php') );
        exit();
        break;
    
      default:
        wp_redirect( admin_url('post.php') );
        exit();
        break;
    }

    Your welcome!

  16. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    @ballhogjoni where does the assignment actually get stored?

    Your code snippet might make for a good secondary plugin. If you want to put it in a Github repo, I'd be happy to help you improve it. There are some security and best practices issues to be concerned about.

  17. ballhogjoni
    Member
    Posted 1 year ago #

    Ok whats your github account, i will add you as a collaborator

  18. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    Pull requests should be fine. Just send the repo link when you have it.

  19. ballhogjoni
    Member
    Posted 1 year ago #

  20. ivnus
    Member
    Posted 1 year ago #

    Thank you ballhogjoni and Daniel for taking this on. Can't wait to see the final snippet.

    I'm seeing on my dev server that it takes 3 post page refreshes to see the post maked as "assigned"

  21. ivnus
    Member
    Posted 1 year ago #

    I made the following changes to make the "Claim" a button in its own column on the posts admin page and change the admin url to admin_url(). I'm using the custom status "available story" and giving everyone with "write_posts" capability the option to claim a post. Also, I added "Already Claimed" when a post is claimed.

    /*
      * Add custom claim column in the posts view
      */
    
    function remove_row_actions( $actions )
    {
        if( get_post_type() === 'post' )
            unset( $actions['view'] );
        return $actions;
    }
    
    function add_claim_column_modify_post_table( $column ) {
        $column['claim'] = 'Claim';
        return $column;
    }
    add_filter( 'manage_posts_columns', 'add_claim_column_modify_post_table' );
    
    function add_claim_button_modify_post_table_row( $column_name, $post_id ) {
        $post = get_post($post_id);
        switch ($column_name) {
            case 'claim':
            	if ( $post->post_status == "available-story" && current_user_can( 'write_posts' ) ) {
                 	add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 );
    		    	echo '<a href="' . admin_url('assign.php?post='.$post_id.'&action=assign') . '" class="button-secondary" title="' . esc_attr( __( 'Claim this Article' ) ) . '">' . __( 'Claim' ) . '</a>';
    			}
    
    			if ( ($post->post_status == "assigned" || $post->post_status == "in-progress" )&& current_user_can( 'edit_post', $post_id ) ) {
       				echo '<script>function unClaim_'.$post_id.'()'.
    				'{ var r = confirm("Are you sure you want to unclaim this post?\n You will lose all work done on the article.");'.
    				'if (r==true){ window.location.href = "' . admin_url('assign.php?post='.$post_id.'&action=unassign') . '";
    				 }}</script><a href="javascript:void(0)" onclick="unClaim_'.$post_id.'()" class="button-secondary" title="' . esc_attr( __( 'Unclaim this Article' ) ) . '">' . __( 'Unclaim' ) . '</a>';
      			}
    
      			if ( $post->post_status == "assigned" && !current_user_can( 'edit_post', $post_id ) ) {
       				echo 'Already Claimed';
      			}
            break;
            default:
        }
    }
    add_filter( 'manage_posts_custom_column', 'add_claim_button_modify_post_table_row', 10, 2 );

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic