$comment_rows = array(); foreach ($commentObjects as $commentObject) { $row = $commentObject->getVarArray(); $comment = $commentObject->exportWpObject(); $postObject =& $postHandler->get($commentObject->getVar('comment_post_ID')); if ($postObject) { $row['post_title'] = $postObject->getVar('post_title'); } $row['comment_date'] = mysql2date(get_settings("date_format") . " @ " . get_settings("time_format"), $commentObject->comment_date); $row['post_title'] = $row['post_title'] == '' ? "# {$commentObject->getVar}('comment_post_ID')" : $row['post_title']; $row['comment_author'] = comment_author(false); $row['comment_author_email'] = comment_author_email_link('', '', '', false); $row['comment_author_url'] = comment_author_url_link('', '', '', false); $row['comment_author_IP'] = comment_author_IP(false); $row['comment_content'] = comment_text(false); if (user_can_edit($postObject->getVar('post_author'))) { $comment_rows[] = $row; } } $ticket = $xoopsWPTicket->getTicketHtml(__LINE__); $wpTpl =& new XoopsTpl(); $wpTpl->error_reporting = error_reporting(); $wpTpl->assign('ignored', $ignored); $wpTpl->assign('deleted', $deleted); $wpTpl->assign('approved', $approved); $wpTpl->assign('comments_notify', get_settings('comments_notify')); $wpTpl->assign('comment_rows', $comment_rows); $wpTpl->assign('ticket', $ticket); $wpTpl->template_dir = wp_base() . '/wp-admin/templates/'; $wpTpl->display('moderation.html'); include 'admin-footer.php';
if ($commentObjects) { $comments_found = true; foreach ($commentObjects as $commentObject) { $row = $commentObject->getVarArray(); $comment = $commentObject->exportWpObject(); //$comment global is used in template_functions. if ($commentObject->getVar('comment_approved') == 0) { $row['class'] = 'class="unapproved" '; } else { $row['class'] = ''; } $postHandler =& wp_handler('Post'); $postObject =& $postHandler->get($commentObject->getVar('comment_post_ID')); if ($postObject) { $row['post_title'] = $postObject->getVar('post_title'); $row['canEdit'] = user_can_edit($postObject->getVar('post_author')); } else { $row['post_title'] = 'No Post exists!!'; $row['canEdit'] = $user_level == 10; } $row['post_title'] = $row['post_title'] == '' ? "# {$commentObject->getVar}('comment_post_ID')" : $row['post_title']; $row['comment_author'] = comment_author(false); $row['comment_author_email'] = comment_author_email_link('', '', '', false); $row['comment_author_url'] = comment_author_url_link('', '', '', false); $row['comment_author_IP'] = comment_author_IP(false); $row['comment_content'] = comment_text(false); $row['comment_date'] = comment_date('Y/m/d H:i:s', false); $row['post_permalink'] = get_permalink($row['comment_post_ID']); $comment_rows[] = $row; } } else {
function edit_comment_link($link = _WP_TPL_EDIT_THIS, $before = '', $after = '', $echo = true) { get_currentuserinfo(); if (!user_can_edit($GLOBALS['post']->post_author)) { return ""; } $location = wp_siteurl() . "/wp-admin/post.php?action=editcomment&comment={$GLOBALS['comment']->comment_ID}"; return _echo("{$before} <a href='{$location}'>{$link}</a> {$after}", $echo); }
function current_user_loggedin($classes) { if (is_user_logged_in() && user_can_edit()) { $classes[] = 'is-edition'; } return $classes; }
> <g id="fond"> <path fill="#FCB421" d="M32.1,63.5c17.2,0,31.2-14,31.2-31.2S49.4,1,32.1,1S0.9,15,0.9,32.2S14.9,63.5,32.1,63.5z"/> </g> <g id="flc"> <g> <rect x="9.7" y="34.7" transform="matrix(0.7071 0.7071 -0.7071 0.7071 33.6223 -4.0188)" fill="#FFFFFF" width="23.9" height="7.8"/> <rect x="19.1" y="29.9" transform="matrix(-0.7071 0.7071 -0.7071 -0.7071 88.3815 30.9903)" fill="#FFFFFF" width="37.4" height="7.8"/> </g> </g> </svg> <?php if (user_can_edit()) { ?> <svg class="icons remove-post" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 64.5 64.5" enable-background="new 0 0 64.5 64.5" xml:space="preserve" data-toggle="tooltip" data-placement="right" title="<?php _e('Remove this post', 'opendoc'); ?> " data-toggle-tooltip-color="#fcb421" > <g> <polygon fill="#EF474B" points="11.4,21.9 24.9,11.4 50.2,13.9 51,32.4 51.4,47.6 34.2,56.9 16.1,52.2 8.5,32.4 "/> <path fill="#FCB421" d="M32.3,1.2C15,1.2,1.1,15.2,1.1,32.4c0,17.2,14,31.2,31.2,31.2c17.2,0,31.2-14,31.2-31.2
require_once './admin-header.php'; wp_refcheck("/wp-admin"); if ($user_level == 0) { die('Cheatin’ uh?'); } $comment = $_GET['comment']; $p = $_GET['p']; if (isset($_GET['noredir'])) { $noredir = true; } else { $noredir = false; } $postdata = get_postdata($p) or die('Oops, no post with this ID. <a href="edit.php">Go back</a>!'); $commentdata = get_commentdata($comment, 1, true) or die('Oops, no comment with this ID. <a href="post.php">Go back</a>!'); $authordata = get_userdata($postdata['Author_ID']); if (!user_can_edit($postdata['Author_ID'])) { die('You don’t have the right to delete <strong>' . $authordata->user_nickname . '</strong>’s post comments. <a href="post.php">Go back</a>!'); } wp_set_comment_status($comment, "delete"); do_action('delete_comment', $comment); if ($_SERVER['HTTP_REFERER'] != "" && false == $noredir) { header('Location: ' . $_SERVER['HTTP_REFERER']); } else { header('Location: ' . $siteurl . '/wp-admin/edit.php?p=' . $p . '&c=1#comments'); } break; case 'unapprovecomment': $standalone = 1; require_once './admin-header.php'; wp_refcheck("/wp-admin"); if ($user_level == 0) {
function edit_comment_link($link = _WP_TPL_EDIT_THIS, $before = '', $after = '') { global $user_level, $post, $comment, $siteurl; get_currentuserinfo(); if ($user_level > 0) { if (!user_can_edit($post->post_author)) { return; } } else { return; } $location = "{$siteurl}/wp-admin/post.php?action=editcomment&comment={$comment->comment_ID}"; echo "{$before} <a href='{$location}'>{$link}</a> {$after}"; }
<li> <?php $comment_status = wp_get_comment_status($comment->comment_ID); if ("unapproved" == $comment_status) { echo "<span class=\"unapproved\">"; } ?> <?php comment_date('Y/m/d'); ?> @ <?php comment_time(); ?> <?php if (user_can_edit($post->post_author)) { echo "[ <a href=\"post.php?action=editcomment&comment=" . $comment->comment_ID . "\">Edit</a>"; echo " - <a href=\"post.php?action=deletecomment&p=" . $post->ID . "&comment=" . $comment->comment_ID . "\" onclick=\"return confirm('You are about to delete this comment by \\'" . $comment->comment_author . "\\'\\n \\'OK\\' to delete, \\'Cancel\\' to stop.')\">Delete</a> "; if ('none' != $comment_status && $user_level >= 3) { if ('approved' == wp_get_comment_status($comment->comment_ID)) { echo " - <a href=\"post.php?action=unapprovecomment&p=" . $post->ID . "&comment=" . $comment->comment_ID . "\">Unapprove</a> "; } else { echo " - <a href=\"post.php?action=approvecomment&p=" . $post->ID . "&comment=" . $comment->comment_ID . "\">Approve</a> "; } } echo "]"; } // end if any comments to show ?> <br /> <strong><?php