Replace get_user_id_from_string() with get_user_by(). props ocean90, bananastalktome. fixes #23192. see #23190.

git-svn-id: https://develop.svn.wordpress.org/trunk@23431 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2013-02-15 18:00:52 +00:00
parent e353d6c033
commit 79df86b818
1 changed files with 4 additions and 6 deletions

View File

@ -1733,21 +1733,19 @@ function fix_phpmailer_messageid( $phpmailer ) {
* Check to see whether a user is marked as a spammer, based on username * Check to see whether a user is marked as a spammer, based on username
* *
* @since MU * @since MU
* @uses get_current_user_id() * @uses get_user_by()
* @uses get_user_id_from_string()
* *
* @param string $username * @param string $username
* @return bool * @return bool
*/ */
function is_user_spammy( $username = 0 ) { function is_user_spammy( $username = 0 ) {
if ( $username == 0 ) { if ( $username == 0 ) {
$user_id = get_current_user_id(); $user = get_user_by( 'id', get_current_user_id() );
} else { } else {
$user_id = get_user_id_from_string( $username ); $user = get_user_by( 'login', $username );
} }
$u = get_userdata( $user_id );
return ( isset( $u->spam ) && $u->spam == 1 ); return ( isset( $user->spam ) && $user->spam == 1 );
} }
/** /**