Commentform filled when logged in
Posted: Sun Aug 15, 2010 2:05 pm
At the moment, the commentform uses only the cookie to remember name, email and url. But when logged in, we have a name and an email we could prefill in the form - the realname and the email entered in personal settings. Following patch (also attached) will do just that, but use the cookie first.
This was requested by an user who don't want to store cookies permanently and also don't want to reenter the data again and again.
This was requested by an user who don't want to store cookies permanently and also don't want to reenter the data again and again.
Code: Select all
--- serendipity-nightly/include/functions_comments.inc.php 2010-05-17 09:43:35.000000000 +0200
+++ /var/www/include/functions_comments.inc.php 2010-08-15 13:43:36.000000000 +0200
@@ -196,8 +196,12 @@
$commentform_data = array(
'commentform_action' => $url,
'commentform_id' => $id,
- 'commentform_name' => isset($data['name']) ? htmlspecialchars($data['name']) : (isset($serendipity['COOKIE']['name']) ? htmlspecialchars($serendipity['COOKIE']['name']) : ''),
- 'commentform_email' => isset($data['email']) ? htmlspecialchars($data['email']) : (isset($serendipity['COOKIE']['email']) ? htmlspecialchars($serendipity['COOKIE']['email']) : ''),
+ 'commentform_name' => isset($data['name']) ? htmlspecialchars($data['name']) :
+ (isset($serendipity['COOKIE']['name']) ? htmlspecialchars($serendipity['COOKIE']['name']) :
+ (isset($serendipity['serendipityRealname']) ? htmlspecialchars($serendipity['serendipityRealname']) : '')),
+ 'commentform_email' => isset($data['email']) ? htmlspecialchars($data['email']) :
+ (isset($serendipity['COOKIE']['email']) ? htmlspecialchars($serendipity['COOKIE']['email']):
+ (isset($serendipity['serendipityEmail']) ? htmlspecialchars($serendipity['serendipityEmail']) : '')),
'commentform_url' => isset($data['url']) ? htmlspecialchars($data['url']) : (isset($serendipity['COOKIE']['url']) ? htmlspecialchars($serendipity['COOKIE']['url']) : ''),
'commentform_remember' => isset($data['remember']) ? 'checked="checked"' : (isset($serendipity['COOKIE']['remember']) ? 'checked="checked"' : ''),
'commentform_replyTo' => serendipity_generateCommentList($id, $comments, ((isset($data['replyTo']) && ($data['replyTo'])) ? $data['replyTo'] : 0)),
@@ -1174,4 +1178,5 @@
}
return serendipity_sendMail($to, $subject, $text, $fromEmail, null, $fromName);
+
}