• Here is what I want to do. Any time a user from user groups “Columnists” and “Contributors” changes their post status to “Pending Review” the user group “Editors” get a notification (auto follow the post).

    Well I keep getting error Parse error: syntax error, unexpected ';' in /home4/josiahw/public_html/sandmag/wp-content/themes/flavor/functions.php on line 55

    Here is what my themes functions.php looks like

    <?php
    /*
    * Sets up the theme by loading the IndustrialThemes class & initializing the framework
    * which activates all classes and functions needed for theme's operation.
    */
    
    # load the IndustrialThemes class
    require_once( get_template_directory() . '/framework.php' );
    
    # get theme data
    $theme_data = wp_get_theme();
    # initialize the IndustrialThemes framework
    IndustrialThemes::init(array(
    	'theme_name' => $theme_data->name,
    	'theme_version' => $theme_data->version
    ));
    
    /**
     * 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;
    
        // When the post is first created, you might want to automatically set
        // all of the user's user groups as following the post
        if ( 'draft' == $new_status ) {
            // Get all of the user groups for this post_author
            $usergroup_ids_to_follow = $edit_flow->user_groups->get_usergroups_for_user( $post->post_author );
            $usergroup_ids_to_follow = array_map( 'intval', $usergroup_ids_to_follow );
            $edit_flow->notifications->follow_post_usergroups( $post->ID, $usergroup_ids_to_follow, true );
        }
    
        // You could also follow a specific user group based on post_status
        if ( 'copy-edit' == $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(
                    // 18,
                );
            $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',
    
    ?>

    I am not sure what to set or what I have wrong here.

    Any help would be much appreciated. Thank you.

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

  • The topic ‘Auto Follow Post Help’ is closed to new replies.