• Resolved makphisto

    (@makphisto)


    Edit flow is great, it really helps our workflow. One thing we’d like is to be able to notify editors (or individual users) when a new post is saved, regardless as to the status of the post. IE, if a contributor comes in and posts something at the Pitch, Pending Review, Draft… whatever; I want the people at the Editors level (or just people I assign to get the emails) to get notifications of these new posts. Is this possible within Edit Flow?

    https://wordpress.org/plugins/edit-flow/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Daniel Bachhuber

    (@danielbachhuber)

    It is possible, although you’ll need a bit of custom code to pull it off. Check out the code examples for some inspiration: http://editflow.org/extend

    Thread Starter makphisto

    (@makphisto)

    Thanks. I looked at that page and thought this code might work:

    /**
     * Auto-subscribe or unsubscribe an Edit Flow user group when a post changes status
     *
     * @see http://editflow.org/extend/auto-subscribe-user-groups-for-notifications/
     *
     * @param string $new_status New post status
     * @param string $old_status Old post status (empty if the post was just created)
     * @param object $post The post being updated
     * @return bool $send_notif Return true to send the email notification, return false to not
     */
    function efx_auto_subscribe_usergroup( $new_status, $old_status, $post ) {
        global $edit_flow;
    
        // You could also follow a specific user group based on post_status
        if ( 'new' == $new_status ) {
            // You'll need to get term IDs for your user groups and place them as
            // comma-separated values
            $usergroup_ids_to_follow = array(
                    // 1358,
                );
            $edit_flow->notifications->follow_post_usergroups( $post->ID, $usergroup_ids_to_follow, true );
        }
    
        // Return true to send the email notification
        return $new_status;
    }
    add_filter( 'ef_notification_status_change', 'efx_auto_subscribe_usergroup', 1358 );
    
    ?>

    From what I understand ‘new’ == $new_status should trigger it when there’s a new post? 1358 is my Editor “group”, should it show up in both places like I have it above?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Notify editors about new post?’ is closed to new replies.