Support » Plugin: Edit Flow » [Plugin: Edit Flow] Auto subscribe User (not User Groups) on status change

  • Resolved jimmywags

    (@jimmywags)


    I looked over the documentation on the Edit Flow website, and thru the Forum here about how to auto subscribe certain users to a post when the status changes. I saw this: http://editflow.org/extend/auto-subscribe-user-groups-for-notifications/ but it only describes the process for User Groups, not individual users. What is the process for auto subscribing a single (or handful) of users to a post when the status of the post changes?

    In our situation, each contributor is assigned to a specific editor. I’d like each editor to only receive notification when one of their contributors updates their post’s status. I could do groups of one and use the filter from the above link, but that seems silly.

    My setup is below. At the end of the two switches, I have one variable, $notify_user, that should be auto-subscribed on a status change. How do I hook that into Edit Flow?

    function efx_auto_subscribe_user( $new_status, $old_status, $post ) {
    	global $edit_flow;
    
    	// Define editor for each author
    	switch( $post->post_author )
    	{
    		case 4: // Andy
    		case 9: // Sarver
    		case 6: // Ryan
    		case 7: // CJ
    			$editor = 5; // Jenn
    			break;
    		case 5: // Jenn
    		case 10: // Jason
    		case 2: // Jim
    		case 8: // McKenzie
    			$editor = 3; // Jess
    			break;
    		case 11: // Phil
    		case 12: // Deidre
    		case 3: // Jess
    			$editor = 4; // Andy
    			break;
    		default:
    			break;
    	}
    
    	switch( $new_status )
    	{
    		case 'pending-review':
    			$notify_user = $editor;
    			break;
    		case 'reviewed':
    			$notify_user = $post->post_author;
    			break;
    		case 'draft':
    		case 'ready-to-publish':
    			$notify_user = 2; // Jim
    		default:
    			break;
    	}
    
    	// Return true to send the email notification
    	return true;
    }

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

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Edit Flow] Auto subscribe User (not User Groups) on status change’ is closed to new replies.