Support » Plugin: Edit Flow » Hide status post

  • Hi

    I need to hide two specific status of post (‘draft’, ‘pending’) for a specific role (http://prntscr.com/ae0cdu).

    Enter your site to track your reference, but it does not work.

    http://editflow.org/extend/limit-custom-statuses-based-on-user-role/

    I added the following code, but I think it does not work.

    Could you please help me!

    /**
     * Limit custom statuses based on user role
     * In this example, we limit the statuses available to the
     * 'contributor' user role
     *
     * @see http://editflow.org/extend/limit-custom-statuses-based-on-user-role/
     *
     * @param array $custom_statuses The existing custom status objects
     * @return array $custom_statuses Our possibly modified set of custom statuses
     */
    function efx_limit_custom_statuses_by_role( $custom_statuses ) {
    
        $current_user = wp_get_current_user();
        switch( $current_user->roles[0] ) {
            // Only allow a contributor to access specific statuses from the dropdown
            case 'contribuidor':
                $permitted_statuses = array(
                        'sinopsis_rechazada',
                        'sinopsis-solicitud',
                        'aprob-sinop',
                        'rev-contenido-editor',
                        'rev_contenido_contr',
                    );
                // Remove the custom status if it's not whitelisted
                foreach( $custom_statuses as $key => $custom_status ) {
                    if ( !in_array( $custom_status->slug, $permitted_statuses ) )
                        unset( $custom_statuses[$key] );
                }
                break;
        }
        return $custom_statuses;
    }
    add_filter( 'ef_custom_status_list', 'efx_limit_custom_statuses_by_role' );

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

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide status post’ is closed to new replies.