Esempio n. 1
0
function ap_get_parti($post_id, $count = false)
{
    global $wpdb;
    if ($count) {
        return ap_meta_total_count('parti', $post_id, false, 'apmeta_userid');
    } else {
        return ap_get_all_meta(array('where' => array('apmeta_type' => array('value' => 'parti', 'compare' => '=', 'relation' => 'AND'), 'apmeta_actionid' => array('value' => $post_id, 'compare' => '=', 'relation' => 'AND')), 'group' => array('apmeta_userid' => array('relation' => 'AND'))), 5);
    }
}
Esempio n. 2
0
function ap_get_parti($post_id = false, $count = false, $param = false)
{
    global $wpdb;
    if ($count) {
        return ap_meta_total_count('parti', $post_id, false, 'apmeta_userid');
    } else {
        $where = array('apmeta_type' => array('value' => 'parti', 'compare' => '=', 'relation' => 'AND'));
        if ($post_id !== false) {
            $where['apmeta_actionid'] = array('value' => $post_id, 'compare' => '=', 'relation' => 'AND');
        }
        if ($param !== false) {
            $where['apmeta_param'] = array('value' => $param, 'compare' => '=', 'relation' => 'AND');
        }
        return ap_get_all_meta(array('where' => $where, 'group' => array('apmeta_userid' => array('relation' => 'AND'))));
    }
}
Esempio n. 3
0
/**
 * Count total numbers of following user 
 * @param  integer 		$user_id
 * @return integer
 */
function ap_following_count($user_id)
{
    return ap_meta_total_count('follower', false, $user_id);
}
Esempio n. 4
0
/**
 * @param integer $id
 */
function ap_get_views_db($id)
{
    return ap_meta_total_count('post_view', $id);
}
Esempio n. 5
0
function ap_received_reputation_post($post_id)
{
    $reputation = ap_reputation_by_event('question_upvote', true);
    $vote_count = ap_meta_total_count('vote_up', $post_id);
    return $vote_count * $reputation;
}
Esempio n. 6
0
/**
 * Count comment flag votes.
 *
 *
 * @return int
 */
function ap_comment_flag_count($comment_id = false)
{
    if (false === $comment_id) {
        $comment_id = get_comment_ID();
    }
    return apply_filters('ap_comment_flag_count', ap_meta_total_count('comment_flag', $comment_id));
}
Esempio n. 7
0
/**
 * post close vote count.
 *
 * @param bool|int $postid
 *
 * @return int
 */
function ap_post_close_vote($postid = false)
{
    global $post;
    $postid = $postid ? $postid : $post->ID;
    return ap_meta_total_count('close', $postid);
}
Esempio n. 8
0
function ap_post_subscribers_count($post_id)
{
    _deprecated_function('ap_post_subscribers_count', '2.2.0.1', 'ap_subscribers_count');
    $post_id = $post_id ? $post_id : get_question_id();
    return ap_meta_total_count('subscriber', $post_id);
}
Esempio n. 9
0
/**
 * Return the count of subscribers for question or term
 * @param  integer $action_id Question id or term_id
 * @param  string $type Type of subscription
 * @return integer
 */
function ap_subscribers_count($action_id = false, $type = '')
{
    $subscribe_type = $type != '' ? 'subscriber_' . $type : 'subscriber';
    $action_id = $action_id ? $action_id : get_question_id();
    return ap_meta_total_count($subscribe_type, $action_id);
}
Esempio n. 10
0
function ap_post_flag_count($postid = false)
{
    global $post;
    $postid = $postid ? $postid : $post->ID;
    return ap_meta_total_count('flag', $postid);
}
Esempio n. 11
0
function ap_received_point_post($post_id)
{
    $point = ap_point_by_event('question_upvote', true);
    $vote_count = ap_meta_total_count('vote_up', $post_id);
    return $vote_count * $point;
}