[wp-hackers] button patch for comment post section
Kristian Gavran
ml at kriga.net
Fri Oct 7 10:05:10 GMT 2005
Hallo all,
my Name is Kristian Gavran and I'm transisting my homepage from a
selfwritten simple CMS system to wordpress.
I make good progresses, the transition is already complete. Along the
transition I've found an annoying point in the comment post section.
When the user forget to fill in all the needed Information just a simple
error message appears.
I thought that a small "Go back and try again" Button on the bottom of
the error message would be a good Idea.
So I've made a small patch adressed to this issue. Maybe you find it
usefull and can commit it. (I have to admit that this is my first patch
to an open source project. So when somthing is not ok or you have some
suggestions, please tell it to me, so that I can make it right :-)
Maybe later when I have some time (and nobody else do it ;-) I will try
to intigrate this (or maybe all?) error messages into the existing
templates system of worldpress.
-Kristian
--
Kristian Gavran
E-Mail: ml at kriga.net
Heimseite: http://www.kriga.net
-------------- next part --------------
*** wordpress/wp-comments-post.php 2005-05-03 00:31:29.000000000 -0700
--- ../wp-comments-post.php 2005-10-07 02:59:36.000000000 -0700
***************
*** 20,25 ****
--- 20,26 ----
$comment_author_email = trim($_POST['email']);
$comment_author_url = trim($_POST['url']);
$comment_content = trim($_POST['comment']);
+ $error_button="<br><input type=button value=\"Go back & try again\" onClick=\"history.go(-1)\">";
// If the user is logged in
get_currentuserinfo();
***************
*** 29,48 ****
$comment_author_url = addslashes($user_url);
else :
if ( get_option('comment_registration') )
! die( __('Sorry, you must be logged in to post a comment.') );
endif;
$comment_type = '';
if ( get_settings('require_name_email') && !$user_ID ) {
if ( 6 > strlen($comment_author_email) || '' == $comment_author )
! die( __('Error: please fill the required fields (name, email).') );
elseif ( !is_email($comment_author_email))
! die( __('Error: please enter a valid email address.') );
}
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', 'user_ID');
--- 30,49 ----
$comment_author_url = addslashes($user_url);
else :
if ( get_option('comment_registration') )
! die( __('<b>Error:</b> Sorry, you must be logged in to post a comment.'.$error_button) );
endif;
$comment_type = '';
if ( get_settings('require_name_email') && !$user_ID ) {
if ( 6 > strlen($comment_author_email) || '' == $comment_author )
! die( __('<b>Error:</b> please fill in the required fields (name, email).'.$error_button) );
elseif ( !is_email($comment_author_email))
! die( __('<b>Error:</b> please enter a valid email address.'.$error_button) );
}
if ( '' == $comment_content )
! die( __('<b>Error:</b> please type a comment.'.$error_button) );
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID');
More information about the wp-hackers
mailing list