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
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) {
function comment_settings($mode, $order, $threshold) {
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) {
......@@ -257,21 +260,41 @@ function comment_thread_max($cid, $mode, $threshold, $level = 0, $dummy = 0) {
}
function comment_render($lid, $cid) {
global $user, $theme, $REQUEST_URI;
global $user, $theme, $mode, $order, $threshold, $REQUEST_URI;
if (user_access("access comments")) {
// Pre-process variables:
$lid = empty($lid) ? 0 : $lid;
$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);
/*
** pre-process variables:
*/
if ($user->uid) {
// Comment control:
$theme->box(t("Comment control"), $theme->comment_controls($threshold, $mode, $order));
if (empty($lid)) {
$lid = 0;
}
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 "<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