Changeset 11997
- Timestamp:
- 10/05/2009 01:49:19 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment.php
r11992 r11997 854 854 * @return mixed False on failure 855 855 */ 856 function wp_trash_comment($comment_id = 0) {857 if ( EMPTY_TRASH_DAYS == 0)856 function wp_trash_comment($comment_id) { 857 if ( EMPTY_TRASH_DAYS == 0 ) 858 858 return wp_delete_comment($comment_id); 859 859 860 if ( !$comment = get_comment($comment_id))860 if ( !$comment = get_comment($comment_id) ) 861 861 return false; 862 862 863 863 do_action('trash_comment', $comment_id); 864 864 865 add_comment_meta($comment_id, '_wp_trash_meta_status', $comment->comment_approved);866 add_comment_meta($comment_id, '_wp_trash_meta_time', time() );865 add_comment_meta($comment_id, '_wp_trash_meta_status', $comment->comment_approved); 866 add_comment_meta($comment_id, '_wp_trash_meta_time', time() ); 867 867 868 868 wp_set_comment_status($comment_id, 'trash'); … … 883 883 * @return mixed False on failure 884 884 */ 885 function wp_untrash_comment($comment_id = 0) { 885 function wp_untrash_comment($comment_id) { 886 if ( ! (int)$comment_id ) 887 return false; 888 886 889 do_action('untrash_comment', $comment_id); 887 890 888 $comment = array('comment_ID'=>$comment_id, 'comment_approved'=>'0'); 889 890 //Either set comment_approved to the value in comment_meta or worse case to false which will mean moderation 891 $comment['comment_approved'] = get_comment_meta($comment_id, '_wp_trash_meta_status', true); 891 $comment = array('comment_ID'=>$comment_id); 892 893 $status = get_comment_meta($comment_id, '_wp_trash_meta_status', true); 894 if ( false === $status || '' === $status ) 895 $status = '0'; 896 897 $comment['comment_approved'] = $status; 892 898 893 899 delete_comment_meta($comment_id, '_wp_trash_meta_time'); 894 900 delete_comment_meta($comment_id, '_wp_trash_meta_status'); 895 901 896 902 wp_update_comment($comment); 897 903 898 904 do_action('untrashed_comment', $comment_id); 899 905
Note: See TracChangeset
for help on using the changeset viewer.