本文整理汇总了PHP中ap_meta_user_done函数的典型用法代码示例。如果您正苦于以下问题:PHP ap_meta_user_done函数的具体用法?PHP ap_meta_user_done怎么用?PHP ap_meta_user_done使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ap_meta_user_done函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ap_is_user_following
function ap_is_user_following($user_to_follow, $current_user_id = false)
{
if ($current_user_id === false) {
$user_id = get_current_user_id();
}
if ($current_user_id > 0) {
$row = ap_meta_user_done('follower', $current_user_id, $user_to_follow);
return $row > 0 ? true : false;
}
return false;
}
示例2: ap_is_user_subscribed
/**
* Check if user is subscribed to question or term
* @param integer $action_id Question id or term id
* @param integer $user_id User id, default is current user id
* @param string|boolean $type Type of subscription, default is question
* @return boolean
* @since unknown
*/
function ap_is_user_subscribed($action_id, $user_id = false, $type = false)
{
if ($user_id === false) {
$user_id = get_current_user_id();
}
if ($user_id > 0) {
if ($type === 'category') {
$subscribe_type = 'category';
} elseif ($type === 'tag') {
$subscribe_type = 'tag';
} else {
$subscribe_type = false;
}
$row = ap_meta_user_done('subscriber', $user_id, $action_id, $subscribe_type);
return $row > 0 ? true : false;
}
return false;
}
示例3: ap_get_total_unread_notification
/**
* Count total numbers of unread notification
* @param boolean|integer $user_id
* @return integer
* @since 2.3
*/
function ap_get_total_unread_notification($user_id = false)
{
if ($user_id === false) {
$user_id = get_current_user_id();
}
return ap_meta_user_done('unread_notification', false, $user_id);
}
示例4: ap_is_already_viewed
function ap_is_already_viewed($user_id, $data_id, $type = 'post_view')
{
$ip = sanitize_text_field($_SERVER['REMOTE_ADDR']);
$done = ap_meta_user_done($type, $user_id, $data_id, false, $ip);
return $done > 0 ? true : false;
}
示例5: ap_is_user_flagged_comment
/**
* Check if user flagged comment.
*
* @param bool|int $comment_id
* @param bool|int $user_id
*
* @since 2.4
*
* @return bool
*/
function ap_is_user_flagged_comment($comment_id = false, $user_id = false)
{
if (!is_user_logged_in()) {
return false;
}
if (false === $comment_id) {
$comment_id = get_comment_ID();
}
if (false === $user_id) {
$user_id = get_current_user_id();
}
$done = ap_meta_user_done('comment_flag', $user_id, $comment_id);
return $done > 0 ? true : false;
}
示例6: ap_is_user_voted_closed
function ap_is_user_voted_closed($postid = false)
{
if (is_user_logged_in()) {
global $post;
$postid = $postid ? $postid : $post->ID;
$userid = get_current_user_id();
$done = ap_meta_user_done('close', $userid, $postid);
return $done > 0 ? true : false;
}
return false;
}
示例7: ap_is_already_viewed
function ap_is_already_viewed($user_id, $data_id, $type = 'question')
{
$done = ap_meta_user_done('post_view', $user_id, $data_id);
return $done > 0 ? true : false;
}