• I stalled the following code, however it doesn’t work. Well, perhaps it works too well. After installation all the statuses disappear, therefore the contributor can’t select any status at all. I tried changing the code in several different ways, however each time I put it in the statuses disappear. What could be the problem?

    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 ‘contributor’:
    $permitted_statuses = array(
    ‘in-progress’,
    ‘pending’,
    );
    // 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 2 replies - 1 through 2 (of 2 total)
  • Plugin Author cojennin

    (@comradefuzz)

    Pitch is the default status for a post. If you’re removing it, you’ll need to change the default. You can do so in the Edit Flow settings under Custom Status. You’ll just need to click Make Default on another custom status.

    Example screenshot of making a new status the default: http://imgur.com/Fd4J78j

    Thread Starter hellobryan

    (@hellobryan)

    Thanks! Works great now. For it to work all statuses for the particular role must be included in the list. For example, if a user opens a post for editing and the current post status is not include in the list of statuses, the user will not be able to change the status at all. However, the current status will be displayed (but not changeable).

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Not Working – Limit Customer Statuses Based on Roles’ is closed to new replies.