Stop users of author role from editing already pending posts

I resolved this by adding checks via the “content_edit_pre” WP hook. I quickly check on the status of the post and if it is already pending I return the user back to the post listing page and then show an error.

// Redirect edit post page back to the list page when pending
add_action( 'content_edit_pre', 'my_check_status_before_editing');
function my_check_status_before_editing( $content, $post_id) {
  global $post;

  if( $post->post_type=="custom-post-type" && get_current_user_role()=="custom-user-type" ){    
       if ($post->post_status=="pending" ){
          wp_redirect("edit.php?post_type=apartments&msg=101");
          exit;  
       } 
    }
    return $content;
 }

function get_current_user_role() {
    global $wp_roles;
    $current_user = wp_get_current_user();
    $roles = $current_user->roles;
    $role = array_shift($roles);
    return $role;
}

When the list page loads I have other code to check if there is a “msg” url param and I then display an appropriate msg via the admin_notices hook.

error code: 523