本文整理汇总了PHP中user_can_edit_post_comments函数的典型用法代码示例。如果您正苦于以下问题:PHP user_can_edit_post_comments函数的具体用法?PHP user_can_edit_post_comments怎么用?PHP user_can_edit_post_comments使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_can_edit_post_comments函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: counterize_print_browser
function counterize_print_browser($before = '', $after = '', $image = false, $between = 'on')
{
global $user_ID, $post, $comment;
get_currentuserinfo();
if (!$comment->comment_agent) {
return;
}
if (user_can_edit_post_comments($user_ID, $post->ID)) {
$uastring = " <a href='#' title='" . htmlspecialchars($comment->comment_agent) . "'>*</a>";
}
$string = counterize_browser_string($comment->comment_agent, $image, $between);
echo $before . $string . $uastring . $after;
}
示例2: user_can_delete_post_comments
/**
* Whether user can delete a post.
*
* @since 1.5
* @deprecated 2.0
* @deprecated Use current_user_can()
* @see current_user_can()
*
* @param int $user_id
* @param int $post_id
* @param int $blog_id Not Used
* @return bool returns true if $user_id can delete $post_id's comments
*/
function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1)
{
_deprecated_function(__FUNCTION__, '2.0', 'current_user_can()');
// right now if one can edit comments, one can delete comments
return user_can_edit_post_comments($user_id, $post_id, $blog_id);
}
示例3: user_can_delete_post_comments
function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1)
{
// right now if one can edit comments, one can delete comments
return user_can_edit_post_comments($user_id, $post_id, $blog_id);
}
示例4: write_comment
function write_comment(&$c, $deep_id = -1, $color = true)
{
global $max_level;
$comments_reply = $GLOBALS['comments_reply'];
if ($c->comment_author_email == get_the_author_email()) {
$style = ' class="mine"';
} else {
if ($color == true) {
$style = ' class="borderc1"';
$color = !$color;
} else {
$style = ' class="borderc2"';
$color = !$color;
}
}
?>
<li id="comment-<?php
echo $c->comment_ID;
?>
" <?php
echo $style;
?>
><div class="commenthead">At <?php
echo mysql2date('Y.m.d H:i', $c->comment_date);
?>
, <a name='comment-<?php
echo $c->comment_ID;
?>
'></a><span><?php
echo get_comment_author_link();
?>
</span> said: </div>
<div class="body">
<?php
comment_text();
?>
</div>
<div class="meta">
<?php
global $user_ID, $post;
get_currentuserinfo();
if (user_can_edit_post_comments($user_ID, $c->comment_post_ID) || $GLOBALS['cmtDepth'] < $max_level) {
echo '[';
}
// delete link
if (user_can_edit_post_comments($user_ID, $c->comment_post_ID)) {
$deleteurl = get_bloginfo("siteurl") . '/wp-admin/comment.php?action=deletecomment&p=' . $c->comment_post_ID . '&c=' . $c->comment_ID;
$deleteurl = wp_nonce_url($deleteurl, 'delete-comment_' . $c->comment_ID);
echo "<a href='{$deleteurl}' onclick='ajaxShowPost(\"{$deleteurl}\", \"comment-{$c->comment_ID}\", \"\", \"alert(\\\"comment is deleted\\\")\", \"delete\");return false;'>delete</a>|";
$spamurl = get_bloginfo("siteurl") . '/wp-admin/comment.php?action=deletecomment&dt=spam&p=' . $c->comment_post_ID . '&c=' . $c->comment_ID;
$spamurl = wp_nonce_url($spamurl, 'delete-comment_' . $c->comment_ID);
echo "<a href='{$spamurl}' onclick='ajaxShowPost(\"{$spamurl}\", \"comment-{$c->comment_ID}\", \"\", \"alert(\\\"comment is spamed\\\")\", \"delete\");return false;'>spam</a>|";
edit_comment_link('Edit', '', $GLOBALS['cmtDepth'] < $max_level ? '|' : '');
}
if ($GLOBALS['cmtDepth'] < $max_level) {
if (get_option("comment_registration") && !$user_ID) {
echo '<a href="' . get_option('siteurl') . '/wp-login.php?redirect_to=' . get_permalink() . '">Log in to Reply</a> ]';
} else {
echo '<a href="javascript:moveForm(' . $c->comment_ID . ')" title="reply">Reply</a>';
}
}
if (user_can_edit_post_comments($user_ID, $post->ID) || $GLOBALS['cmtDepth'] < $max_level) {
echo ']</div>';
}
if ($comments_reply[$c->comment_ID]) {
$id = $c->comment_ID;
if ($GLOBALS['cmtDepth'] < $max_level) {
echo '<ul>';
}
$first_c = true;
foreach ($comments_reply[$id] as $c) {
if ($first_c) {
$first_c = false;
continue;
}
$GLOBALS['cmtDepth']++;
if ($GLOBALS['cmtDepth'] == $max_level) {
write_comment($c, $c->comment_ID, $color);
} else {
write_comment($c, $deep_id, $color);
}
$GLOBALS['cmtDepth']--;
}
if ($GLOBALS['cmtDepth'] < $max_level) {
echo '</ul>';
}
}
echo '</li>';
}
示例5: wp_notify_postauthor
wp_notify_postauthor($comment);
}
if ($_SERVER['HTTP_REFERER'] != "" && false == $noredir) {
header('Location: ' . $_SERVER['HTTP_REFERER']);
} else {
header('Location: ' . get_settings('siteurl') . '/wp-admin/edit.php?p=' . $p . '&c=1#comments');
}
break;
case 'editedcomment':
$comment_ID = (int) $_POST['comment_ID'];
$comment_post_ID = (int) $_POST['comment_post_ID'];
$newcomment_author = $_POST['newcomment_author'];
$newcomment_author_email = $_POST['newcomment_author_email'];
$newcomment_author_url = $_POST['newcomment_author_url'];
$comment_status = $_POST['comment_status'];
if (!user_can_edit_post_comments($user_ID, $comment_post_ID)) {
die(__('You are not allowed to edit comments on this post, so you cannot edit this comment.'));
}
if (user_can_edit_post_date($user_ID, $post_ID) && !empty($_POST['edit_date'])) {
$aa = $_POST['aa'];
$mm = $_POST['mm'];
$jj = $_POST['jj'];
$hh = $_POST['hh'];
$mn = $_POST['mn'];
$ss = $_POST['ss'];
$jj = $jj > 31 ? 31 : $jj;
$hh = $hh > 23 ? $hh - 24 : $hh;
$mn = $mn > 59 ? $mn - 60 : $mn;
$ss = $ss > 59 ? $ss - 60 : $ss;
$datemodif = ", comment_date = '{$aa}-{$mm}-{$jj} {$hh}:{$mn}:{$ss}'";
} else {
示例6: write_comment
function write_comment(&$c, $deep_id = -1, $color = true)
{
global $max_level;
$comments_reply = $GLOBALS['comments_reply'];
if ($c->comment_author_email == 'mathzqy@gmail.com' || $c->comment_author_email == 'math.zqy@gmail.com' || $c->comment_author_email == 'zhang@zhiqiang.org') {
$style = ' class="mine"';
} else {
if ($color == true) {
$style = ' class="borderc1"';
$color = !$color;
} else {
$style = ' class="borderc2"';
$color = !$color;
}
}
?>
<li id="comment-<?php
echo $c->comment_ID;
?>
" <?php
echo $style;
?>
><div class="commenthead">At <?php
echo mysql2date('Y.m.d H:i', $c->comment_date);
?>
, <a name='comment-<?php
echo $c->comment_ID;
?>
'></a><span><?php
echo get_comment_author_link();
?>
</span> said: </div>
<div class="body">
<?php
comment_text();
?>
</div>
<div class="meta">
<?php
global $user_ID, $post;
get_currentuserinfo();
if (user_can_edit_post_comments($user_ID, $post->ID) || $GLOBALS['cmtDepth'] < $max_level) {
echo '[';
}
// comment_favicon();
edit_comment_link('Edit', '', $GLOBALS['cmtDepth'] < $max_level ? '|' : '');
if ($GLOBALS['cmtDepth'] < $max_level) {
if (get_option("comment_registration") && !$user_ID) {
echo '<a href="' . get_option('siteurl') . '/wp-login.php?redirect_to=' . get_permalink() . '">Log in to Reply</a> ]';
} else {
echo '<a href="javascript:moveForm(' . $c->comment_ID . ')" title="reply">Reply</a>';
}
}
if (user_can_edit_post_comments($user_ID, $post->ID) || $GLOBALS['cmtDepth'] < $max_level) {
echo ']</div>';
}
if ($comments_reply[$c->comment_ID]) {
$id = $c->comment_ID;
if ($GLOBALS['cmtDepth'] < $max_level) {
echo '<ul>';
}
foreach ($comments_reply[$id] as $c) {
$GLOBALS['cmtDepth']++;
if ($GLOBALS['cmtDepth'] == $max_level) {
write_comment($c, $c->comment_ID, $color);
} else {
write_comment($c, $deep_id, $color);
}
$GLOBALS['cmtDepth']--;
}
if ($GLOBALS['cmtDepth'] < $max_level) {
echo '</ul>';
}
}
echo '</li>';
}
示例7: edit_comment_link
function edit_comment_link($link = 'Edit This', $before = '', $after = '') {
global $user_ID, $post, $comment;
get_currentuserinfo();
if ( !user_can_edit_post_comments($user_ID, $post->ID) )
return;
$location = get_settings('siteurl') . "/wp-admin/post.php?action=editcomment&comment=$comment->comment_ID";
echo $before . "<a href='$location'>$link</a>" . $after;
}
示例8: edit_comment_link
function edit_comment_link($link = 'Edit This', $before = '', $after = '')
{
global $user_ID, $post, $comment;
get_currentuserinfo();
if (!user_can_edit_post_comments($user_ID, $post->ID)) {
return;
}
$location = get_settings('siteurl') . "/wp-admin/post.php?action=editcomment&comment={$comment->comment_ID}";
echo "{$before} <a href='{$location}'>{$link}</a> {$after}";
}