7 */ |
7 */ |
8 |
8 |
9 /** Load WordPress Bootstrap */ |
9 /** Load WordPress Bootstrap */ |
10 require_once( dirname( __FILE__ ) . '/admin.php' ); |
10 require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 |
11 |
12 $parent_file = 'edit-comments.php'; |
12 $parent_file = 'edit-comments.php'; |
13 $submenu_file = 'edit-comments.php'; |
13 $submenu_file = 'edit-comments.php'; |
14 |
14 |
15 /** |
15 /** |
16 * @global string $action |
16 * @global string $action |
17 */ |
17 */ |
18 global $action; |
18 global $action; |
19 wp_reset_vars( array('action') ); |
19 wp_reset_vars( array( 'action' ) ); |
20 |
20 |
21 if ( isset( $_POST['deletecomment'] ) ) |
21 if ( isset( $_POST['deletecomment'] ) ) { |
22 $action = 'deletecomment'; |
22 $action = 'deletecomment'; |
23 |
23 } |
24 if ( 'cdc' == $action ) |
24 |
|
25 if ( 'cdc' == $action ) { |
25 $action = 'delete'; |
26 $action = 'delete'; |
26 elseif ( 'mac' == $action ) |
27 } elseif ( 'mac' == $action ) { |
27 $action = 'approve'; |
28 $action = 'approve'; |
|
29 } |
28 |
30 |
29 if ( isset( $_GET['dt'] ) ) { |
31 if ( isset( $_GET['dt'] ) ) { |
30 if ( 'spam' == $_GET['dt'] ) |
32 if ( 'spam' == $_GET['dt'] ) { |
31 $action = 'spam'; |
33 $action = 'spam'; |
32 elseif ( 'trash' == $_GET['dt'] ) |
34 } elseif ( 'trash' == $_GET['dt'] ) { |
33 $action = 'trash'; |
35 $action = 'trash'; |
34 } |
|
35 |
|
36 switch( $action ) { |
|
37 |
|
38 case 'editcomment' : |
|
39 $title = __('Edit Comment'); |
|
40 |
|
41 get_current_screen()->add_help_tab( array( |
|
42 'id' => 'overview', |
|
43 'title' => __('Overview'), |
|
44 'content' => |
|
45 '<p>' . __( 'You can edit the information left in a comment if needed. This is often useful when you notice that a commenter has made a typographical error.' ) . '</p>' . |
|
46 '<p>' . __( 'You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment.' ) . '</p>' |
|
47 ) ); |
|
48 |
|
49 get_current_screen()->set_help_sidebar( |
|
50 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
51 '<p>' . __( '<a href="https://codex.wordpress.org/Administration_Screens#Comments">Documentation on Comments</a>' ) . '</p>' . |
|
52 '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>' |
|
53 ); |
|
54 |
|
55 wp_enqueue_script('comment'); |
|
56 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
57 |
|
58 $comment_id = absint( $_GET['c'] ); |
|
59 |
|
60 if ( !$comment = get_comment( $comment_id ) ) |
|
61 comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'javascript:history.go(-1)') ); |
|
62 |
|
63 if ( !current_user_can( 'edit_comment', $comment_id ) ) |
|
64 comment_footer_die( __('Sorry, you are not allowed to edit this comment.') ); |
|
65 |
|
66 if ( 'trash' == $comment->comment_approved ) |
|
67 comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') ); |
|
68 |
|
69 $comment = get_comment_to_edit( $comment_id ); |
|
70 |
|
71 include( ABSPATH . 'wp-admin/edit-form-comment.php' ); |
|
72 |
|
73 break; |
|
74 |
|
75 case 'delete' : |
|
76 case 'approve' : |
|
77 case 'trash' : |
|
78 case 'spam' : |
|
79 |
|
80 $title = __('Moderate Comment'); |
|
81 |
|
82 $comment_id = absint( $_GET['c'] ); |
|
83 |
|
84 if ( ! $comment = get_comment( $comment_id ) ) { |
|
85 wp_redirect( admin_url('edit-comments.php?error=1') ); |
|
86 die(); |
|
87 } |
|
88 |
|
89 if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) { |
|
90 wp_redirect( admin_url('edit-comments.php?error=2') ); |
|
91 die(); |
|
92 } |
|
93 |
|
94 // No need to re-approve/re-trash/re-spam a comment. |
|
95 if ( $action == str_replace( '1', 'approve', $comment->comment_approved ) ) { |
|
96 wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) ); |
|
97 die(); |
|
98 } |
|
99 |
|
100 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
101 |
|
102 $formaction = $action . 'comment'; |
|
103 $nonce_action = 'approve' == $action ? 'approve-comment_' : 'delete-comment_'; |
|
104 $nonce_action .= $comment_id; |
|
105 |
|
106 ?> |
|
107 <div class="wrap"> |
|
108 |
|
109 <h1><?php echo esc_html( $title ); ?></h1> |
|
110 |
|
111 <?php |
|
112 switch ( $action ) { |
|
113 case 'spam' : |
|
114 $caution_msg = __('You are about to mark the following comment as spam:'); |
|
115 $button = _x( 'Mark as Spam', 'comment' ); |
|
116 break; |
|
117 case 'trash' : |
|
118 $caution_msg = __('You are about to move the following comment to the Trash:'); |
|
119 $button = __('Move to Trash'); |
|
120 break; |
|
121 case 'delete' : |
|
122 $caution_msg = __('You are about to delete the following comment:'); |
|
123 $button = __('Permanently Delete Comment'); |
|
124 break; |
|
125 default : |
|
126 $caution_msg = __('You are about to approve the following comment:'); |
|
127 $button = __('Approve Comment'); |
|
128 break; |
|
129 } |
|
130 |
|
131 if ( $comment->comment_approved != '0' ) { // if not unapproved |
|
132 $message = ''; |
|
133 switch ( $comment->comment_approved ) { |
|
134 case '1' : |
|
135 $message = __('This comment is currently approved.'); |
|
136 break; |
|
137 case 'spam' : |
|
138 $message = __('This comment is currently marked as spam.'); |
|
139 break; |
|
140 case 'trash' : |
|
141 $message = __('This comment is currently in the Trash.'); |
|
142 break; |
|
143 } |
|
144 if ( $message ) { |
|
145 echo '<div id="message" class="notice notice-info"><p>' . $message . '</p></div>'; |
|
146 } |
36 } |
147 } |
37 } |
148 ?> |
38 |
|
39 switch ( $action ) { |
|
40 |
|
41 case 'editcomment': |
|
42 $title = __( 'Edit Comment' ); |
|
43 |
|
44 get_current_screen()->add_help_tab( |
|
45 array( |
|
46 'id' => 'overview', |
|
47 'title' => __( 'Overview' ), |
|
48 'content' => |
|
49 '<p>' . __( 'You can edit the information left in a comment if needed. This is often useful when you notice that a commenter has made a typographical error.' ) . '</p>' . |
|
50 '<p>' . __( 'You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment.' ) . '</p>', |
|
51 ) |
|
52 ); |
|
53 |
|
54 get_current_screen()->set_help_sidebar( |
|
55 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
56 '<p>' . __( '<a href="https://codex.wordpress.org/Administration_Screens#Comments">Documentation on Comments</a>' ) . '</p>' . |
|
57 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
|
58 ); |
|
59 |
|
60 wp_enqueue_script( 'comment' ); |
|
61 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
62 |
|
63 $comment_id = absint( $_GET['c'] ); |
|
64 |
|
65 if ( ! $comment = get_comment( $comment_id ) ) { |
|
66 comment_footer_die( __( 'Invalid comment ID.' ) . sprintf( ' <a href="%s">' . __( 'Go back' ) . '</a>.', 'javascript:history.go(-1)' ) ); |
|
67 } |
|
68 |
|
69 if ( ! current_user_can( 'edit_comment', $comment_id ) ) { |
|
70 comment_footer_die( __( 'Sorry, you are not allowed to edit this comment.' ) ); |
|
71 } |
|
72 |
|
73 if ( 'trash' == $comment->comment_approved ) { |
|
74 comment_footer_die( __( 'This comment is in the Trash. Please move it out of the Trash if you want to edit it.' ) ); |
|
75 } |
|
76 |
|
77 $comment = get_comment_to_edit( $comment_id ); |
|
78 |
|
79 include( ABSPATH . 'wp-admin/edit-form-comment.php' ); |
|
80 |
|
81 break; |
|
82 |
|
83 case 'delete': |
|
84 case 'approve': |
|
85 case 'trash': |
|
86 case 'spam': |
|
87 $title = __( 'Moderate Comment' ); |
|
88 |
|
89 $comment_id = absint( $_GET['c'] ); |
|
90 |
|
91 if ( ! $comment = get_comment( $comment_id ) ) { |
|
92 wp_redirect( admin_url( 'edit-comments.php?error=1' ) ); |
|
93 die(); |
|
94 } |
|
95 |
|
96 if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) { |
|
97 wp_redirect( admin_url( 'edit-comments.php?error=2' ) ); |
|
98 die(); |
|
99 } |
|
100 |
|
101 // No need to re-approve/re-trash/re-spam a comment. |
|
102 if ( $action == str_replace( '1', 'approve', $comment->comment_approved ) ) { |
|
103 wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) ); |
|
104 die(); |
|
105 } |
|
106 |
|
107 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
108 |
|
109 $formaction = $action . 'comment'; |
|
110 $nonce_action = 'approve' == $action ? 'approve-comment_' : 'delete-comment_'; |
|
111 $nonce_action .= $comment_id; |
|
112 |
|
113 ?> |
|
114 <div class="wrap"> |
|
115 |
|
116 <h1><?php echo esc_html( $title ); ?></h1> |
|
117 |
|
118 <?php |
|
119 switch ( $action ) { |
|
120 case 'spam': |
|
121 $caution_msg = __( 'You are about to mark the following comment as spam:' ); |
|
122 $button = _x( 'Mark as Spam', 'comment' ); |
|
123 break; |
|
124 case 'trash': |
|
125 $caution_msg = __( 'You are about to move the following comment to the Trash:' ); |
|
126 $button = __( 'Move to Trash' ); |
|
127 break; |
|
128 case 'delete': |
|
129 $caution_msg = __( 'You are about to delete the following comment:' ); |
|
130 $button = __( 'Permanently Delete Comment' ); |
|
131 break; |
|
132 default: |
|
133 $caution_msg = __( 'You are about to approve the following comment:' ); |
|
134 $button = __( 'Approve Comment' ); |
|
135 break; |
|
136 } |
|
137 |
|
138 if ( $comment->comment_approved != '0' ) { // if not unapproved |
|
139 $message = ''; |
|
140 switch ( $comment->comment_approved ) { |
|
141 case '1': |
|
142 $message = __( 'This comment is currently approved.' ); |
|
143 break; |
|
144 case 'spam': |
|
145 $message = __( 'This comment is currently marked as spam.' ); |
|
146 break; |
|
147 case 'trash': |
|
148 $message = __( 'This comment is currently in the Trash.' ); |
|
149 break; |
|
150 } |
|
151 if ( $message ) { |
|
152 echo '<div id="message" class="notice notice-info"><p>' . $message . '</p></div>'; |
|
153 } |
|
154 } |
|
155 ?> |
149 <div id="message" class="notice notice-warning"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php echo $caution_msg; ?></p></div> |
156 <div id="message" class="notice notice-warning"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php echo $caution_msg; ?></p></div> |
150 |
157 |
151 <table class="form-table comment-ays"> |
158 <table class="form-table comment-ays"> |
152 <tr> |
159 <tr> |
153 <th scope="row"><?php _e('Author'); ?></th> |
160 <th scope="row"><?php _e( 'Author' ); ?></th> |
154 <td><?php comment_author( $comment ); ?></td> |
161 <td><?php comment_author( $comment ); ?></td> |
155 </tr> |
162 </tr> |
156 <?php if ( get_comment_author_email( $comment ) ) { ?> |
163 <?php if ( get_comment_author_email( $comment ) ) { ?> |
157 <tr> |
164 <tr> |
158 <th scope="row"><?php _e('Email'); ?></th> |
165 <th scope="row"><?php _e( 'Email' ); ?></th> |
159 <td><?php comment_author_email( $comment ); ?></td> |
166 <td><?php comment_author_email( $comment ); ?></td> |
160 </tr> |
167 </tr> |
161 <?php } ?> |
168 <?php } ?> |
162 <?php if ( get_comment_author_url( $comment ) ) { ?> |
169 <?php if ( get_comment_author_url( $comment ) ) { ?> |
163 <tr> |
170 <tr> |
164 <th scope="row"><?php _e('URL'); ?></th> |
171 <th scope="row"><?php _e( 'URL' ); ?></th> |
165 <td><a href="<?php comment_author_url( $comment ); ?>"><?php comment_author_url( $comment ); ?></a></td> |
172 <td><a href="<?php comment_author_url( $comment ); ?>"><?php comment_author_url( $comment ); ?></a></td> |
166 </tr> |
173 </tr> |
167 <?php } ?> |
174 <?php } ?> |
168 <tr> |
175 <tr> |
169 <th scope="row"><?php /* translators: column name or table row header */ _e( 'In Response To' ); ?></th> |
176 <th scope="row"><?php /* translators: column name or table row header */ _e( 'In Response To' ); ?></th> |
170 <td> |
177 <td> |
171 <?php |
178 <?php |
172 $post_id = $comment->comment_post_ID; |
179 $post_id = $comment->comment_post_ID; |
173 if ( current_user_can( 'edit_post', $post_id ) ) { |
180 if ( current_user_can( 'edit_post', $post_id ) ) { |
174 $post_link = "<a href='" . esc_url( get_edit_post_link( $post_id ) ) . "'>"; |
181 $post_link = "<a href='" . esc_url( get_edit_post_link( $post_id ) ) . "'>"; |
175 $post_link .= esc_html( get_the_title( $post_id ) ) . '</a>'; |
182 $post_link .= esc_html( get_the_title( $post_id ) ) . '</a>'; |
176 } else { |
183 } else { |
177 $post_link = esc_html( get_the_title( $post_id ) ); |
184 $post_link = esc_html( get_the_title( $post_id ) ); |
178 } |
185 } |
179 echo $post_link; |
186 echo $post_link; |
186 /* translators: %s: comment link */ |
193 /* translators: %s: comment link */ |
187 ' | ' . __( 'In reply to %s.' ), |
194 ' | ' . __( 'In reply to %s.' ), |
188 '<a href="' . $parent_link . '">' . $name . '</a>' |
195 '<a href="' . $parent_link . '">' . $name . '</a>' |
189 ); |
196 ); |
190 } |
197 } |
191 ?> |
198 ?> |
192 </td> |
199 </td> |
193 </tr> |
200 </tr> |
194 <tr> |
201 <tr> |
195 <th scope="row"><?php _e( 'Submitted on' ); ?></th> |
202 <th scope="row"><?php _e( 'Submitted on' ); ?></th> |
196 <td> |
203 <td> |
197 <?php |
204 <?php |
198 /* translators: 1: comment date, 2: comment time */ |
205 /* translators: 1: comment date, 2: comment time */ |
199 $submitted = sprintf( __( '%1$s at %2$s' ), |
206 $submitted = sprintf( |
|
207 __( '%1$s at %2$s' ), |
200 /* translators: comment date format. See https://secure.php.net/date */ |
208 /* translators: comment date format. See https://secure.php.net/date */ |
201 get_comment_date( __( 'Y/m/d' ), $comment ), |
209 get_comment_date( __( 'Y/m/d' ), $comment ), |
202 get_comment_date( __( 'g:i a' ), $comment ) |
210 get_comment_date( __( 'g:i a' ), $comment ) |
203 ); |
211 ); |
204 if ( 'approved' === wp_get_comment_status( $comment ) && ! empty ( $comment->comment_post_ID ) ) { |
212 if ( 'approved' === wp_get_comment_status( $comment ) && ! empty( $comment->comment_post_ID ) ) { |
205 echo '<a href="' . esc_url( get_comment_link( $comment ) ) . '">' . $submitted . '</a>'; |
213 echo '<a href="' . esc_url( get_comment_link( $comment ) ) . '">' . $submitted . '</a>'; |
206 } else { |
214 } else { |
207 echo $submitted; |
215 echo $submitted; |
208 } |
216 } |
209 ?> |
217 ?> |
|
218 </td> |
|
219 </tr> |
|
220 <tr> |
|
221 <th scope="row"><?php /* translators: field name in comment form */ _ex( 'Comment', 'noun' ); ?></th> |
|
222 <td class="comment-content"> |
|
223 <?php comment_text( $comment ); ?> |
|
224 <p class="edit-comment"><a href="<?php echo admin_url( "comment.php?action=editcomment&c={$comment->comment_ID}" ); ?>"><?php esc_html_e( 'Edit' ); ?></a></p> |
210 </td> |
225 </td> |
211 </tr> |
226 </tr> |
212 <tr> |
227 </table> |
213 <th scope="row"><?php /* translators: field name in comment form */ _ex('Comment', 'noun'); ?></th> |
228 |
214 <td class="comment-content"> |
229 <form action="comment.php" method="get" class="comment-ays-submit"> |
215 <?php comment_text( $comment ); ?> |
230 |
216 <p class="edit-comment"><a href="<?php echo admin_url( "comment.php?action=editcomment&c={$comment->comment_ID}" ); ?>"><?php esc_html_e( 'Edit' ); ?></a></p> |
231 <p> |
217 </td> |
232 <?php submit_button( $button, 'primary', 'submit', false ); ?> |
218 </tr> |
233 <a href="<?php echo admin_url( 'edit-comments.php' ); ?>" class="button-cancel"><?php esc_html_e( 'Cancel' ); ?></a> |
219 </table> |
234 </p> |
220 |
235 |
221 <form action="comment.php" method="get" class="comment-ays-submit"> |
236 <?php wp_nonce_field( $nonce_action ); ?> |
222 |
237 <input type="hidden" name="action" value="<?php echo esc_attr( $formaction ); ?>" /> |
223 <p> |
238 <input type="hidden" name="c" value="<?php echo esc_attr( $comment->comment_ID ); ?>" /> |
224 <?php submit_button( $button, 'primary', 'submit', false ); ?> |
239 <input type="hidden" name="noredir" value="1" /> |
225 <a href="<?php echo admin_url('edit-comments.php'); ?>" class="button-cancel"><?php esc_html_e( 'Cancel' ); ?></a> |
240 </form> |
226 </p> |
241 |
227 |
242 </div> |
228 <?php wp_nonce_field( $nonce_action ); ?> |
243 <?php |
229 <input type="hidden" name="action" value="<?php echo esc_attr($formaction); ?>" /> |
244 break; |
230 <input type="hidden" name="c" value="<?php echo esc_attr($comment->comment_ID); ?>" /> |
245 |
231 <input type="hidden" name="noredir" value="1" /> |
246 case 'deletecomment': |
232 </form> |
247 case 'trashcomment': |
233 |
248 case 'untrashcomment': |
234 </div> |
249 case 'spamcomment': |
235 <?php |
250 case 'unspamcomment': |
236 break; |
251 case 'approvecomment': |
237 |
252 case 'unapprovecomment': |
238 case 'deletecomment' : |
253 $comment_id = absint( $_REQUEST['c'] ); |
239 case 'trashcomment' : |
254 |
240 case 'untrashcomment' : |
255 if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) { |
241 case 'spamcomment' : |
256 check_admin_referer( 'approve-comment_' . $comment_id ); |
242 case 'unspamcomment' : |
257 } else { |
243 case 'approvecomment' : |
258 check_admin_referer( 'delete-comment_' . $comment_id ); |
244 case 'unapprovecomment' : |
259 } |
245 $comment_id = absint( $_REQUEST['c'] ); |
260 |
246 |
261 $noredir = isset( $_REQUEST['noredir'] ); |
247 if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) |
262 |
248 check_admin_referer( 'approve-comment_' . $comment_id ); |
263 if ( ! $comment = get_comment( $comment_id ) ) { |
249 else |
264 comment_footer_die( __( 'Invalid comment ID.' ) . sprintf( ' <a href="%s">' . __( 'Go back' ) . '</a>.', 'edit-comments.php' ) ); |
250 check_admin_referer( 'delete-comment_' . $comment_id ); |
265 } |
251 |
266 if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) { |
252 $noredir = isset($_REQUEST['noredir']); |
267 comment_footer_die( __( 'Sorry, you are not allowed to edit comments on this post.' ) ); |
253 |
268 } |
254 if ( !$comment = get_comment($comment_id) ) |
269 |
255 comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'edit-comments.php') ); |
270 if ( '' != wp_get_referer() && ! $noredir && false === strpos( wp_get_referer(), 'comment.php' ) ) { |
256 if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) |
271 $redir = wp_get_referer(); |
257 comment_footer_die( __('Sorry, you are not allowed to edit comments on this post.') ); |
272 } elseif ( '' != wp_get_original_referer() && ! $noredir ) { |
258 |
273 $redir = wp_get_original_referer(); |
259 if ( '' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php') ) |
274 } elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) { |
260 $redir = wp_get_referer(); |
275 $redir = admin_url( 'edit-comments.php?p=' . absint( $comment->comment_post_ID ) ); |
261 elseif ( '' != wp_get_original_referer() && ! $noredir ) |
276 } else { |
262 $redir = wp_get_original_referer(); |
277 $redir = admin_url( 'edit-comments.php' ); |
263 elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) |
278 } |
264 $redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) ); |
279 |
265 else |
280 $redir = remove_query_arg( array( 'spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved' ), $redir ); |
266 $redir = admin_url('edit-comments.php'); |
281 |
267 |
282 switch ( $action ) { |
268 $redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved'), $redir ); |
283 case 'deletecomment': |
269 |
284 wp_delete_comment( $comment ); |
270 switch ( $action ) { |
285 $redir = add_query_arg( array( 'deleted' => '1' ), $redir ); |
271 case 'deletecomment' : |
286 break; |
272 wp_delete_comment( $comment ); |
287 case 'trashcomment': |
273 $redir = add_query_arg( array('deleted' => '1'), $redir ); |
288 wp_trash_comment( $comment ); |
274 break; |
289 $redir = add_query_arg( |
275 case 'trashcomment' : |
290 array( |
276 wp_trash_comment( $comment ); |
291 'trashed' => '1', |
277 $redir = add_query_arg( array('trashed' => '1', 'ids' => $comment_id), $redir ); |
292 'ids' => $comment_id, |
278 break; |
293 ), |
279 case 'untrashcomment' : |
294 $redir |
280 wp_untrash_comment( $comment ); |
295 ); |
281 $redir = add_query_arg( array('untrashed' => '1'), $redir ); |
296 break; |
282 break; |
297 case 'untrashcomment': |
283 case 'spamcomment' : |
298 wp_untrash_comment( $comment ); |
284 wp_spam_comment( $comment ); |
299 $redir = add_query_arg( array( 'untrashed' => '1' ), $redir ); |
285 $redir = add_query_arg( array('spammed' => '1', 'ids' => $comment_id), $redir ); |
300 break; |
286 break; |
301 case 'spamcomment': |
287 case 'unspamcomment' : |
302 wp_spam_comment( $comment ); |
288 wp_unspam_comment( $comment ); |
303 $redir = add_query_arg( |
289 $redir = add_query_arg( array('unspammed' => '1'), $redir ); |
304 array( |
290 break; |
305 'spammed' => '1', |
291 case 'approvecomment' : |
306 'ids' => $comment_id, |
292 wp_set_comment_status( $comment, 'approve' ); |
307 ), |
293 $redir = add_query_arg( array( 'approved' => 1 ), $redir ); |
308 $redir |
294 break; |
309 ); |
295 case 'unapprovecomment' : |
310 break; |
296 wp_set_comment_status( $comment, 'hold' ); |
311 case 'unspamcomment': |
297 $redir = add_query_arg( array( 'unapproved' => 1 ), $redir ); |
312 wp_unspam_comment( $comment ); |
298 break; |
313 $redir = add_query_arg( array( 'unspammed' => '1' ), $redir ); |
299 } |
314 break; |
300 |
315 case 'approvecomment': |
301 wp_redirect( $redir ); |
316 wp_set_comment_status( $comment, 'approve' ); |
302 die; |
317 $redir = add_query_arg( array( 'approved' => 1 ), $redir ); |
303 |
318 break; |
304 case 'editedcomment' : |
319 case 'unapprovecomment': |
305 |
320 wp_set_comment_status( $comment, 'hold' ); |
306 $comment_id = absint( $_POST['comment_ID'] ); |
321 $redir = add_query_arg( array( 'unapproved' => 1 ), $redir ); |
307 $comment_post_id = absint( $_POST['comment_post_ID'] ); |
322 break; |
308 |
323 } |
309 check_admin_referer( 'update-comment_' . $comment_id ); |
324 |
310 |
325 wp_redirect( $redir ); |
311 edit_comment(); |
326 die; |
312 |
327 |
313 $location = ( empty( $_POST['referredby'] ) ? "edit-comments.php?p=$comment_post_id" : $_POST['referredby'] ) . '#comment-' . $comment_id; |
328 case 'editedcomment': |
314 |
329 $comment_id = absint( $_POST['comment_ID'] ); |
315 /** |
330 $comment_post_id = absint( $_POST['comment_post_ID'] ); |
316 * Filters the URI the user is redirected to after editing a comment in the admin. |
331 |
317 * |
332 check_admin_referer( 'update-comment_' . $comment_id ); |
318 * @since 2.1.0 |
333 |
319 * |
334 edit_comment(); |
320 * @param string $location The URI the user will be redirected to. |
335 |
321 * @param int $comment_id The ID of the comment being edited. |
336 $location = ( empty( $_POST['referredby'] ) ? "edit-comments.php?p=$comment_post_id" : $_POST['referredby'] ) . '#comment-' . $comment_id; |
322 */ |
337 |
323 $location = apply_filters( 'comment_edit_redirect', $location, $comment_id ); |
338 /** |
324 wp_redirect( $location ); |
339 * Filters the URI the user is redirected to after editing a comment in the admin. |
325 |
340 * |
326 exit(); |
341 * @since 2.1.0 |
327 |
342 * |
328 default: |
343 * @param string $location The URI the user will be redirected to. |
329 wp_die( __('Unknown action.') ); |
344 * @param int $comment_id The ID of the comment being edited. |
|
345 */ |
|
346 $location = apply_filters( 'comment_edit_redirect', $location, $comment_id ); |
|
347 wp_redirect( $location ); |
|
348 |
|
349 exit(); |
|
350 |
|
351 default: |
|
352 wp_die( __( 'Unknown action.' ) ); |
330 |
353 |
331 } // end switch |
354 } // end switch |
332 |
355 |
333 include( ABSPATH . 'wp-admin/admin-footer.php' ); |
356 include( ABSPATH . 'wp-admin/admin-footer.php' ); |