Introduce WP_User::exists(). see #20372

git-svn-id: http://svn.automattic.com/wordpress/trunk@20378 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2012-04-06 19:18:45 +00:00
parent f06fb15878
commit de41bc288b
9 changed files with 25 additions and 13 deletions

View File

@@ -54,7 +54,7 @@ $comment_content = ( isset($_POST['comment']) ) ? trim($_POST['comment']) :
// If the user is logged in
$user = wp_get_current_user();
if ( $user->ID ) {
if ( $user->exists() ) {
if ( empty( $user->display_name ) )
$user->display_name=$user->user_login;
$comment_author = $wpdb->escape($user->display_name);
@@ -73,7 +73,7 @@ if ( $user->ID ) {
$comment_type = '';
if ( get_option('require_name_email') && !$user->ID ) {
if ( get_option('require_name_email') && !$user->exists() ) {
if ( 6 > strlen($comment_author_email) || '' == $comment_author )
wp_die( __('<strong>ERROR</strong>: please fill the required fields (name, email).') );
elseif ( !is_email($comment_author_email))