Author select fix & ACP action buttons
Hi,
WP has a bug where some authors/users are missing form the author select when editing posts. It seems that a custom fix for this (below) doesn’t play nicely with the ACP action buttons, each time they’re used the author changes to last user in the author select.
add_filter('wp_dropdown_users', 'MySwitchUser');
function MySwitchUser($output)
{
global $post;
//global $post is available here, hence you can check for the post type here
$users = get_users();
$output = "<select id=\"post_author_override\" name=\"post_author_override\" class=\"\">";
//Leave the admin in the list
$output .= "<option value=\"1\">Admin</option>";
foreach($users as $user)
{
$sel = ($post->post_author == $user->ID)?"selected='selected'":'';
$output .= '<option value="'.$user->ID.'"'.$sel.'>'.$user->user_login.'</option>';
}
$output .= "</select>";
return $output;
}
PS: Directly after using a ACP action button, the table line layout for the corresponding post is off, basically the action buttons and all columns after them to the right are gone (plus a few other on the left).
Cheers,
Thomas
You must be logged in to reply to this topic.