Ok, so it appears that there is no built in way to do this, so I had to add a custom filter as a hack.
In www\wp-comments-post.php add this on line 89 (right above $comment_id = wp_new_comment( $commentdata );
) –
$commentdata = apply_filters('pre_override_comment_data', $commentdata);
Add this to your functions.php file –
/**
* Adds a User dropdown to allow admins to assign comments to users
*/
add_action('comment_form_top', 'set_comment_author_id');
function set_comment_author_id(){
if(current_user_can('manage_options')){
echo '<label for="priority_menu">Add comment for user - </label>';
wp_dropdown_users(array('selected' => 1, 'tab_index' => 1, 'name' => 'comment_author_selection', 'class' => 'dropdown'));
}
}
/**
* Gathers the information for a user chosed to assign a comment to
* @param array $commentdata The current comment data
* @return array The commentdata The updated comment data
*/
add_filter('pre_override_comment_data', 'set_comment_data');
function set_comment_data($commentdata){
$userdata = get_userdata((int)$_POST['comment_author_selection']);
$commentdata['user_ID'] = $userdata->ID;
$commentdata['comment_author'] = $userdata->user_login;
$commentdata['comment_author_email'] = $userdata->user_email;
$commentdata['comment_author_url'] = $userdata->user_url;
return $commentdata;
}
And hey presto, admins (who can ‘manage_options’ in this example) can now assign a comment to a user of their choice.