mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Comment registration goodness. Hat tip to Jason at noprequisite.com for user_identity code.
git-svn-id: https://develop.svn.wordpress.org/trunk@2166 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -18,9 +18,18 @@ $comment_author_email = $_POST['email'];
|
||||
$comment_author_url = $_POST['url'];
|
||||
$comment_content = $_POST['comment'];
|
||||
|
||||
$comment_type = '';
|
||||
// If the user is logged in
|
||||
get_currentuserinfo();
|
||||
if ( $user_ID ) :
|
||||
$comment_author = $user_login;
|
||||
$comment_author_email = $user_email;
|
||||
$comment_author_url = str_replace('http://', '', $user_url);
|
||||
else :
|
||||
if ( get_option('comment_registration') )
|
||||
die( __('Sorry, you must be logged in to post a comment.') );
|
||||
endif;
|
||||
|
||||
$user_ip = apply_filters('pre_comment_user_ip', $_SERVER['REMOTE_ADDR']);
|
||||
$comment_type = '';
|
||||
|
||||
if ( get_settings('require_name_email') && ('' == $comment_author_email || '' == $comment_author) )
|
||||
die( __('Error: please fill the required fields (name, email).') );
|
||||
@@ -28,7 +37,7 @@ if ( get_settings('require_name_email') && ('' == $comment_author_email || '' ==
|
||||
if ( '' == $comment_content )
|
||||
die( __('Error: please type a comment.') );
|
||||
|
||||
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type');
|
||||
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID');
|
||||
|
||||
wp_new_comment($commentdata);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user