ap_user_votes_pre_fetch( array $ids )
Description #
Pre fetch and cache all votes by given post ID.
Parameters #
- $idsarray (Required) Post IDs.
Source #
File: includes/votes.php
function ap_user_votes_pre_fetch( $ids ) {
if ( $ids && is_user_logged_in() ) {
$votes = ap_get_votes(
array(
'vote_post_id' => (array) $ids,
'vote_user_id' => get_current_user_id(),
'vote_type' => array( 'flag', 'vote' ),
)
);
$cache_keys = array();
foreach ( (array) $ids as $post_id ) {
$cache_keys[ $post_id . '_' . get_current_user_id() . '_flag' ] = true;
$cache_keys[ $post_id . '_' . get_current_user_id() . '_vote' ] = true;
}
foreach ( (array) $votes as $vote ) {
unset( $cache_keys[ $vote->vote_post_id . '_' . $vote->vote_user_id . '_' . $vote->vote_type ] );
}
}
}
Expand full source code Collapse full source code View on GitHub: includes/votes.php:678
Add your comment