当前位置: 首页>>代码示例>>PHP>>正文


PHP user_can_edit_post_comments函数代码示例

本文整理汇总了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;
}
开发者ID:selectSIFISO,项目名称:.comsite,代码行数:13,代码来源:counterize_browsniff.php

示例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);
}
开发者ID:rkglug,项目名称:WordPress,代码行数:19,代码来源:deprecated.php

示例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);
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:5,代码来源:deprecated.php

示例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&amp;p=' . $c->comment_post_ID . '&amp;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&amp;dt=spam&amp;p=' . $c->comment_post_ID . '&amp;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>';
}
开发者ID:sontv1003,项目名称:vtcacademy,代码行数:89,代码来源:getcomments.php

示例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 {
开发者ID:BackupTheBerlios,项目名称:steampress-svn,代码行数:31,代码来源:post.php

示例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>';
}
开发者ID:BGCX261,项目名称:zhiqiang-blog-svn-to-git,代码行数:76,代码来源:comments.php

示例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&amp;comment=$comment->comment_ID";
	echo $before . "<a href='$location'>$link</a>" . $after;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:11,代码来源:template-functions-links.php

示例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&amp;comment={$comment->comment_ID}";
    echo "{$before} <a href='{$location}'>{$link}</a> {$after}";
}
开发者ID:BackupTheBerlios,项目名称:steampress-svn,代码行数:10,代码来源:template-functions-links.php


注:本文中的user_can_edit_post_comments函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。