ap_is_user_voted( integer $post_id, string|array $type = 'vote', integer $user_id = false )

Description #

Check if user vote on a post.

Parameters #

  • $post_id
    integer (Required) Post ID.
  • $type
    string | array (Optional) Vote type. Default value: 'vote'
  • $user_id
    integer (Optional) User ID. Default value: false

Source #

File: includes/votes.php

function ap_is_user_voted( $post_id, $type = 'vote', $user_id = false ) {
	if ( false === $user_id ) {
		$user_id = get_current_user_id();
	}

	if ( false === ap_get_vote( $post_id, $user_id, $type ) ) {
		return false;
	}

	return true;
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment