This function determines whether the a user can access a given post (by ID). It can use the current logged in user, as in the example below, or an alternate user ID can be provided.

global $post;

if(wp_fusion()->access->user_can_access($post->ID)) {

	echo "Welcome to the post.";

} else {

	echo "Sorry, but this content is restricted.";


You can also pass in a user ID as the second argument to perform the check on other users. For example, to check by a user’s email address:

$user = get_user_by( 'email', '' );

if(wp_fusion()->access->user_can_access($post->ID, $user->ID)) {

	echo "Welcome to the post.";