From 4131b785f7e36862cbcc937c4a395f0bb5fc5874 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 5 Aug 2003 18:33:39 +0000 Subject: - Help system improvements from Michael. --- modules/comment.module | 180 ++++++++++++++++++++++++------------------------- 1 file changed, 90 insertions(+), 90 deletions(-) (limited to 'modules/comment.module') diff --git a/modules/comment.module b/modules/comment.module index 7aba64229..66667bf68 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -4,71 +4,76 @@ $GLOBALS["cmodes"] = array(1 => t("Flat list - collapsed"), 2 => t("Flat list - expanded"), 3 => t("Threaded list - collapsed"), 4 => t("Threaded list - expanded")); $GLOBALS["corder"] = array(1 => t("Date - newest first"), 2 => t("Date - oldest first")); -function comment_help() { - $output .= t("

When enabled, the Drupal comment module creates a discussion board for each Drupal node. Users can post comments to discuss a forum topic, weblog post, collaborative book page, etc.

- -

User control of comment display

-

Attached to each comment board is a control panel for customizing the way that comments are displayed. Users can control the chronological ordering of posts (newest or oldest first) and the number of posts to display on each page. Additional settings include:

- -

When users choose save settings, the comments are then redisplayed with the user's choices. Know that administrators can set the default settings for the control panel, along with other comment configuration defaults, in site configuration » modules » comment.

-

NOTE: When comment moderation is enabled, users will have another control panel option to control thresholds (see below).

- -

Additional comment configurations

-

Comments behave like other user submissions in Drupal. Filters, smileys and HTML that work in nodes will also work with content. To prevent a single user from spamming the web site with too many comments, administrators can set a comment throttle in site configuration under Submission settings.

-

Administrators can control access to various comment module functions through user management » user permissions. Know that in a new Drupal installation, all comment permissions are disabled by default. The choice of which permissions to grant to which roles (groups of users) is left up to the site administrator.

-

The following permissions can be enabled for anonymous users, authenticated users, or any other roles that the administrator chooses to define:

- - -

Notification of new comments

-

Drupal provides specific features to inform site members when new comments have been posted:

- - -

Comment moderation

-

On sites with active commenting from users, the administrator can turn over comment moderation to the community.

-

With comment moderation, each comment is automatically assigned an initial rating. As users read comments, they can apply a vote which affects the comment rating. At the same time, users have an additional option in the control panel which allows them to set a threshold for comment display. Those comments with ratings lower than the set threshold will not appear.

-

To enable moderation, the administrator must grant moderate comments permissions. Then, a number of options in comment management » comment moderation must be configured.

- -

Moderation votes

-

The first step is to create moderation labels which allow users to rate a comment. Go to comment management » comment moderation » votes. In the vote field, enter the textual labels which users will see when casting their votes. Some examples might be

- -

So that users know how there votes affect the comment, these examples include the vote value as part of the label, although that is optional.

-

Using the weight option, you can control the order in which the votes appear to users. Setting the weight heavier (positive numbers) will make the vote label appear at the bottom of the list. Lighter (a negative number) will push it to the top. To encourage positive voting, a useful order might be higher values, positive votes, at the top, with negative votes at the bottom.

- -

Moderators/vote values matrix

- -

Next go to comment management » comment moderation » matrix. Enter vote values for each of the labels in the matrix with each permission role. The values entered here will be used to create the rating for each comment.

-

NOTE: Comment ratings are calculated by averaging user votes with the initial rating.

-

Creating comment thresholds

+function comment_help($section = "admin/comment/help") { + $output = ""; + + switch ($section) { + case 'admin/help': + case 'admin/comment/help': + $output .= "

When enabled, the Drupal comment module creates a discussion board for each Drupal node. Users can post comments to discuss a forum topic, weblog post, collaborative book page, etc.

"; + $output .= "

User control of comment display

"; + $output .= "

Attached to each comment board is a control panel for customizing the way that comments are displayed. Users can control the chronological ordering of posts (newest or oldest first) and the number of posts to display on each page. Additional settings include:

"; + $output .= ""; + $output .= strtr("

When a user chooses save settings, the comments are then redisplayed using the user's new choices. Administrators can set the default settings for the comment control panel, along with other comment defaults, in %comment-config.

",array("%comment-config" => l(t("site configuration » modules » comment"), "admin/system/modules/comment") )); + $output .= "

NOTE: When comment moderation is enabled, users will have another control panel option to control thresholds (see below).

"; + + $output .= "

Additional comment configurations

"; + $output .= strtr("

Comments behave like other user submissions in Drupal. Filters, smileys and HTML that work in nodes will also work with content. To prevent a single user from spamming the web site with too many comments, administrators can set a comment throttle in %site-config under Submission settings.

", array("%site-config" => l(t("site configuration"), "admin/system") )); + $output .= strtr("

Administrators can control access to various comment module functions through %user-permissions. Know that in a new Drupal installation, all comment permissions are disabled by default. The choice of which permissions to grant to which roles (groups of users) is left up to the site administrator.

", array("%user-permissions" => l(t("user management » user permissions"), "admin/user/permission") )); + $output .= "

The following permissions can be enabled for anonymous users, authenticated users, or any other user roles that the administrator chooses to define:

"; + $output .= ""; + + $output .= "

Notification of new comments

"; + $output .= "

Drupal provides specific features to inform site members when new comments have been posted:

"; + $output .= ""; + + $output .= "

Comment moderation

"; + $output .= "

On sites with active commenting from users, the administrator can turn over comment moderation to the community.

"; + $output .= "

With comment moderation, each comment is automatically assigned an initial rating. As users read comments, they can apply a vote which affects the comment rating. At the same time, users have an additional option in the control panel which allows them to set a threshold for the comments they wish to view. Those comments with ratings lower than the set threshold will not be shown.

"; + $output .= strtr("

To enable moderation, the administrator must grant %permission permissions. Then, a number of options in %comment-moderation must be configured.

", array("%permission" => l(t("moderate comments"), "admin/user/permissions"), "%comment-moderation" => l(t("comment management » comment moderation"), "admin/comment/moderation") )); + + $output .= "

Moderation votes

"; + $output .= strtr("

The first step is to create moderation labels which allow users to rate a comment. Go to %comment-votes. In the vote field, enter the textual labels which users will see when casting their votes. Some examples are

", array("%comment-votes" => l(t("comment management » comment moderation » votes"), "admin/comment/moderation/votes") )); + $output .= ""; + $output .= "

So that users know how their votes affect the comment, these examples include the vote value as part of the label, although that is optional.

"; + $output .= "

Using the weight option, you can control the order in which the votes appear to users. Setting the weight heavier (positive numbers) will make the vote label appear at the bottom of the list. Lighter (a negative number) will push it to the top. To encourage positive voting, a useful order might be higher values, positive votes, at the top, with negative votes at the bottom.

"; + + $output .= "

Moderators/vote values matrix

"; + + $output .= strtr("

Next go to %comment-matrix. Enter the values for the vote labels for each permission role in the vote matrix. The values entered here will be used to create the rating for each comment.

", array("%comment-matrix" => l(t("comment management » comment moderation » matrix"), "admin/comment/moderation/,atrix") )); + $output .= "

NOTE: Comment ratings are calculated by averaging user votes with the initial rating.

"; + $output .= "

Creating comment thresholds

In comment management » comment moderation » thresholds, you'll have to create some comment thresholds to make the comment rating system useful. When comment moderation is enabled and the thresholds are created, users will find another comment control panel option for selecting thresholds. They'll use the thresholds you enter here to filter out comments with low ratings. Consequently, you'll probably want to create more than one threshold to give users some flexibility in filtering comments.

When creating the thresholds, note that the Minimum score is asking you for the lowest rating that a comment can have in order to be displayed.

To see a common example of how thresholds work, you might visit Slashdot and view one of their comment boards associated with a story. You can reset the thresholds in their comment control panel.

Initial comment scores

-

Finally, you may want to enter some initial comment scores. In comment management » initial comment scores you can assign a beginning rating for all comments posted by a particular permission role. If you do not assign any initial scores, Drupal will assign a rating of 0 as the default.

"); - - return $output; +

Finally, you may want to enter some initial comment scores. In comment management » initial comment scores you can assign a beginning rating for all comments posted by a particular permission role. If you do not assign any initial scores, Drupal will assign a rating of 0 as the default.

"; + break; + } + return t($output); } function comment_system($field) { @@ -1226,6 +1231,11 @@ function comment_moderation_form($comment) { } } + if (user_access("administer comments")) { + $options .= " \n"; + $options .= " \n"; + } + $output .= "\n"; } @@ -1325,7 +1335,9 @@ function comment_visible($comment, $threshold = 0) { } function comment_moderate() { - global $moderation, $user; + global $user; + + $moderation = $_POST["moderation"]; if ($moderation) { $result = db_query("SELECT mid, value FROM {moderation_roles} WHERE rid = %d", $user->rid); @@ -1338,40 +1350,28 @@ function comment_moderate() { if (user_access("administer comments") || comment_user_can_moderate($node)) { foreach ($moderation as $cid => $vote) { if ($vote) { - if (($vote == 'offline') && (user_access("administer comments"))) { - db_query("UPDATE {comments} SET status = 1 WHERE cid = %d", $cid); - watchdog("special", "comment: unpublished comment #". $cid); + $comment = db_fetch_object(db_query("SELECT * FROM {comments} WHERE cid = %d", $cid)); + $users = unserialize($comment->users); + if ($user->uid != $comment->uid && !(comment_already_moderated($user->uid, $comment->users))) { + $users[$user->uid] = $vote; + $tot_score = 0; + foreach ($users as $uid => $vote) { + if ($uid) { + $tot_score = $tot_score + $votes[$vote]; + } + else { + // vote 0 is the start value + $tot_score = $tot_score + $vote; + } + } + $new_score = round($tot_score / count($users)); + db_query("UPDATE {comments} SET score = '$new_score', users = '%s' WHERE cid = %d", serialize($users), $cid); /* ** Fire a hook */ - module_invoke_all("comment", "unpublish", $cid); - } - else { - $comment = db_fetch_object(db_query("SELECT * FROM {comments} WHERE cid = %d", $cid)); - $users = unserialize($comment->users); - if ($user->uid != $comment->uid && !(comment_already_moderated($user->uid, $comment->users))) { - $users[$user->uid] = $vote; - $tot_score = 0; - foreach ($users as $uid => $vote) { - if ($uid) { - $tot_score = $tot_score + $votes[$vote]; - } - else { - // vote 0 is the start value - $tot_score = $tot_score + $vote; - } - } - $new_score = round($tot_score / count($users)); - db_query("UPDATE {comments} SET score = '$new_score', users = '%s' WHERE cid = %d", serialize($users), $cid); - - /* - ** Fire a hook - */ - - module_invoke_all("comment", "moderate", $cid, $vote); - } + module_invoke_all("comment", "moderate", $cid, $vote); } } } -- cgit v1.2.3