Make WordPress Core


Ignore:
Timestamp:
11/15/2003 08:58:18 AM (23 years ago)
Author:
saxmatt
Message:

Cleaning up comment moderation and the comment code in general. More to do tomorrow with regards to wp-moderation.php.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/wp-moderation.php

    r546 r549  
    4343
    4444    $standalone = 1;
    45     require_once("b2header.php");
     45    require_once('b2header.php');
    4646
    4747    if ($user_level < 3) {
    48         die('<p>You have no right to moderate comments.<br />Ask for a promotion to your <a href="mailto:$admin_email">blog admin</a>. :)</p>');
     48        die('<p>Your level is not high enough to moderate comments. Ask for a promotion from your <a href="mailto:$admin_email">blog admin</a>. :)</p>');
    4949    }
    5050   
    5151    // check if comment moderation is turned on in the settings
    5252    // if not, just give a short note and stop
    53     if (get_settings("comment_moderation") == "none") {
    54         echo "<div class=\"wrap\">\n";
    55         echo "Comment moderation has been turned off.<br /><br />\n";
    56         echo "</div>\n";
    57         include("b2footer.php");
     53    if ('none' == get_settings("comment_moderation")) {
     54        echo '<div class="wrap">
     55        <p>Comment moderation has been turned off.</p>
     56        </div>';
     57        require('b2footer.php');
    5858        exit;
    5959    }   
     
    6565    foreach($comment as $key => $value) {
    6666        switch($value) {
    67         case "later":
    68         // do nothing with that comment
    69         // wp_set_comment_status($key, "hold");
    70         ++$item_ignored;
    71         break;
    72        
    73         case "delete":
    74         wp_set_comment_status($key, "delete");
    75         ++$item_deleted;
    76         break;
    77        
    78         case "approve":
    79         wp_set_comment_status($key, "approve");
    80         if (get_settings("comments_notify") == true) {
    81             wp_notify_postauthor($key);
    82         }
    83         ++$item_approved;
    84         break;
     67            case 'later':
     68                // do nothing with that comment
     69                // wp_set_comment_status($key, "hold");
     70                ++$item_ignored;
     71                break;
     72           
     73            case 'delete':
     74                wp_set_comment_status($key, 'delete');
     75                ++$item_deleted;
     76                break;
     77           
     78            case 'approve':
     79                wp_set_comment_status($key, 'approve');
     80                if (get_settings('comments_notify') == true) {
     81                    wp_notify_postauthor($key);
     82                }
     83                ++$item_approved;
     84                break;
    8585        }
    8686    }
     
    9797
    9898    if ($user_level <= 3) {
    99         die('<p>You have no right to moderate comments.<br>Ask for a promotion to your <a href="mailto:$admin_email">blog admin</a>. :)</p>');
     99        die('<p>Your level is not high enough to moderate comments. Ask for a promotion from your <a href="mailto:$admin_email">blog admin</a>. :)</p>');
    100100    }
    101101
    102102    // check if comment moderation is turned on in the settings
    103103    // if not, just give a short note and stop
    104     if (get_settings("comment_moderation") == "none") {
    105         echo "<div class=\"wrap\">\n";
    106         echo "Comment moderation has been turned off.<br /><br />\n";
    107         echo "</div>\n";
     104    if ('none' == get_settings('comment_moderation')) {
     105        echo '<div class="wrap">
     106        <p>Comment moderation has been turned off.</p>
     107        </div>';
    108108        include("b2footer.php");
    109109        exit;
     
    145145    <?php
    146146   
    147 $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_approved='0'");
     147$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_approved = 0");
    148148if ($comments) {
    149149    // list all comments that are waiting for approval
Note: See TracChangeset for help on using the changeset viewer.