wp_get_current_commenter()
返回一个数组\'comment_author\'
存储名称:
Array (
[\'comment_author\'] => \'Harriet Smith,
[\'comment_author_email\'] => \'hsmith@,example.com\',
[\'comment_author_url\'] => \'http://example.com/\'
)
有关更多信息,请访问
codex.
Update
要找到好名字,请询问DB:
/**
* Searches the user table by display name.
* @param string $display_name
* @return object
*/
function get_user_by_display_name( $display_name )
{
global $wpdb;
$user = $wpdb->get_row(
$wpdb->prepare("SELECT * FROM $wpdb->users WHERE display_name = %s", $display_name)
);
if ( ! $user )
{
return FALSE;
}
_fill_user($user);
return $user;
}
// Usage:
if ( $userdata = get_user_by_display_name( \'Thomas Scholz\' ) )
{
print $userdata->user_nicename;
}
警告:未测试。:)