Changeset 2258 for trunk/wp-includes/comment-functions.php
- Timestamp:
- 02/11/2005 01:52:19 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment-functions.php
r2239 r2258 569 569 570 570 571 /* wp_set_comment_status:572 part of otaku42's comment moderation hack573 changes the status of a comment according to $comment_status.574 allowed values:575 hold : set comment_approve field to 0576 approve: set comment_approve field to 1577 delete : remove comment out of database578 579 returns true if change could be applied580 returns false on database error or invalid value for $comment_status581 */582 571 function wp_set_comment_status($comment_id, $comment_status) { 583 572 global $wpdb; … … 590 579 $query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1"; 591 580 break; 581 case 'spam': 582 $query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1"; 583 break; 592 584 case 'delete': 593 585 $query = "DELETE FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"; … … 606 598 607 599 608 /* wp_get_comment_status609 part of otaku42's comment moderation hack610 gets the current status of a comment611 612 returned values:613 "approved" : comment has been approved614 "unapproved": comment has not been approved615 "deleted ": comment not found in database616 617 a (boolean) false signals an error618 */619 600 function wp_get_comment_status($comment_id) { 620 global $wpdb; 621 622 $result = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); 623 if ($result == NULL) { 624 return "deleted"; 625 } else if ($result == "1") { 626 return "approved"; 627 } else if ($result == "0") { 628 return "unapproved"; 629 } else { 630 return false; 631 } 601 global $wpdb; 602 603 $result = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); 604 if ($result == NULL) { 605 return 'deleted'; 606 } else if ($result == '1') { 607 return 'approved'; 608 } else if ($result == '0') { 609 return 'unapproved'; 610 } else if ($result == 'spam') { 611 return 'spam'; 612 } else { 613 return false; 614 } 632 615 } 633 616
Note: See TracChangeset
for help on using the changeset viewer.