Skip to content
Snippets Groups Projects
Commit 9239aaea authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Fixed bug reported by Kristjan and Mike: anonymous users can post
  comments now.

- Improved the comment system so that anonymous users can change the
  comment settings.
parent 57c399a0
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -45,7 +45,10 @@ function comment_moderate($moderate) { ...@@ -45,7 +45,10 @@ function comment_moderate($moderate) {
function comment_settings($mode, $order, $threshold) { function comment_settings($mode, $order, $threshold) {
global $user; global $user;
if ($user->uid) $user = user_save($user, array("mode" => $mode, "sort" => $order, "threshold" => $threshold));
if ($user->uid) {
$user = user_save($user, array("mode" => $mode, "sort" => $order, "threshold" => $threshold));
}
} }
function comment_form($edit) { function comment_form($edit) {
...@@ -257,21 +260,41 @@ function comment_thread_max($cid, $mode, $threshold, $level = 0, $dummy = 0) { ...@@ -257,21 +260,41 @@ function comment_thread_max($cid, $mode, $threshold, $level = 0, $dummy = 0) {
} }
function comment_render($lid, $cid) { function comment_render($lid, $cid) {
global $user, $theme, $REQUEST_URI; global $user, $theme, $mode, $order, $threshold, $REQUEST_URI;
if (user_access("access comments")) { if (user_access("access comments")) {
// Pre-process variables: /*
$lid = empty($lid) ? 0 : $lid; ** pre-process variables:
$cid = empty($cid) ? 0 : $cid; */
$mode = ($user->uid) ? $user->mode : variable_get(default_comment_mode, 4);
$order = ($user->uid) ? $user->sort : variable_get(default_comment_order, 1);
$threshold = ($user->uid) ? $user->threshold : variable_get(default_comment_threshold, 3);
if ($user->uid) { if (empty($lid)) {
// Comment control: $lid = 0;
$theme->box(t("Comment control"), $theme->comment_controls($threshold, $mode, $order)); }
if (empty($cid)) {
$cide = 0;
}
if (empty($mode)) {
$mode = $user->uid ? $user->mode : variable_get(default_comment_mode, 4);
}
if (empty($order)) {
$order = $user->uid ? $user->sort : variable_get(default_comment_order, 1);
}
if (empty($threshold)) {
$threshold = $user->uid ? $user->threshold : variable_get(default_comment_threshold, 3);
}
/*
** Render comment control:
*/
$theme->box(t("Comment control"), $theme->comment_controls($threshold, $mode, $order));
if ($user->uid) {
// Print moderation form: // Print moderation form:
print "<FORM METHOD=\"post\" ACTION=\"$REQUEST_URI\">\n"; print "<FORM METHOD=\"post\" ACTION=\"$REQUEST_URI\">\n";
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment