136 |
136 |
} else {
|
137 |
137 |
echo '<h3>' . esc_html( __( 'Total Posts', 'reckoning' ) ) . ': ' . esc_html( count( $posts ) ) . '</h3>';
|
138 |
138 |
echo "<table class = 'reckoning-table'>";
|
139 |
|
echo "<tr><th colspan='3'>User Posts</th></tr>";
|
|
139 |
echo "<tr><th colspan='4'>User Posts</th></tr>";
|
|
140 |
|
|
141 |
$pending_counts = get_pending_comments_num( wp_list_pluck( $posts, 'ID' ) );
|
|
142 |
|
140 |
143 |
foreach ( $posts as $post ) :
|
141 |
144 |
echo '<tr>';
|
142 |
145 |
preg_match( '/([0-9]{4})-([0-9]{2})-([0-9]{2})/', $post->post_date, $matches );
|
... | ... | |
146 |
149 |
echo '</a></td>';
|
147 |
150 |
echo '<td>' . get_the_category_list( ', ', '', $post->ID ) . '</td>';
|
148 |
151 |
echo '<td>' . esc_html( $date ) . '</td>';
|
|
152 |
|
|
153 |
echo '<td class="column-comments">';
|
|
154 |
echo '<div class="post-com-count-wrapper">';
|
|
155 |
|
|
156 |
$pending_comments = isset( $pending_counts[ $post->ID ] ) ? $pending_counts[ $post->ID ] : 0;
|
|
157 |
reckoning_comments_bubble( $post->ID, $pending_comments );
|
|
158 |
echo '</div>';
|
|
159 |
echo '</td>';
|
|
160 |
|
149 |
161 |
echo '</tr>';
|
150 |
|
echo '<tr><td colspan="3">' . wp_kses_post( $post->post_content ) . '</td></tr>';
|
|
162 |
echo '<tr><td colspan="4">' . wp_kses_post( $post->post_content ) . '</td></tr>';
|
151 |
163 |
endforeach;
|
152 |
164 |
echo '</table>';
|
153 |
165 |
}
|
... | ... | |
308 |
320 |
echo '</div>';
|
309 |
321 |
|
310 |
322 |
} // display_reckoning_admin_page_all
|
|
323 |
|
|
324 |
function reckoning_comments_bubble( $post_id, $pending_comments ) {
|
|
325 |
$approved_comments = get_comments_number( $post_id );
|
|
326 |
|
|
327 |
$approved_comments_number = number_format_i18n( $approved_comments );
|
|
328 |
$pending_comments_number = number_format_i18n( $pending_comments );
|
|
329 |
|
|
330 |
$approved_only_phrase = sprintf( _n( '%s comment', '%s comments', $approved_comments ), $approved_comments_number );
|
|
331 |
$approved_phrase = sprintf( _n( '%s approved comment', '%s approved comments', $approved_comments ), $approved_comments_number );
|
|
332 |
$pending_phrase = sprintf( _n( '%s pending comment', '%s pending comments', $pending_comments ), $pending_comments_number );
|
|
333 |
|
|
334 |
// No comments at all.
|
|
335 |
if ( ! $approved_comments && ! $pending_comments ) {
|
|
336 |
printf(
|
|
337 |
'<span aria-hidden="true">—</span><span class="screen-reader-text">%s</span>',
|
|
338 |
__( 'No comments' )
|
|
339 |
);
|
|
340 |
// Approved comments have different display depending on some conditions.
|
|
341 |
} elseif ( $approved_comments ) {
|
|
342 |
printf(
|
|
343 |
'<a href="%s" class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
|
|
344 |
esc_url(
|
|
345 |
add_query_arg(
|
|
346 |
array(
|
|
347 |
'p' => $post_id,
|
|
348 |
'comment_status' => 'approved',
|
|
349 |
),
|
|
350 |
admin_url( 'edit-comments.php' )
|
|
351 |
)
|
|
352 |
),
|
|
353 |
$approved_comments_number,
|
|
354 |
$pending_comments ? $approved_phrase : $approved_only_phrase
|
|
355 |
);
|
|
356 |
} else {
|
|
357 |
printf(
|
|
358 |
'<span class="post-com-count post-com-count-no-comments"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
|
|
359 |
$approved_comments_number,
|
|
360 |
$pending_comments ? __( 'No approved comments' ) : __( 'No comments' )
|
|
361 |
);
|
|
362 |
}
|
|
363 |
|
|
364 |
if ( $pending_comments ) {
|
|
365 |
printf(
|
|
366 |
'<a href="%s" class="post-com-count post-com-count-pending"><span class="comment-count-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
|
|
367 |
esc_url(
|
|
368 |
add_query_arg(
|
|
369 |
array(
|
|
370 |
'p' => $post_id,
|
|
371 |
'comment_status' => 'moderated',
|
|
372 |
),
|
|
373 |
admin_url( 'edit-comments.php' )
|
|
374 |
)
|
|
375 |
),
|
|
376 |
$pending_comments_number,
|
|
377 |
$pending_phrase
|
|
378 |
);
|
|
379 |
} else {
|
|
380 |
printf(
|
|
381 |
'<span class="post-com-count post-com-count-pending post-com-count-no-pending"><span class="comment-count comment-count-no-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
|
|
382 |
$pending_comments_number,
|
|
383 |
$approved_comments ? __( 'No pending comments' ) : __( 'No comments' )
|
|
384 |
);
|
|
385 |
}
|
|
386 |
}
|