How can I check user access?

[ad_1]

@chefranov

You can read this guide about “Content Restriction”

https://docs.ultimatemember.com/article/1736-content-restriction

Your first echo with the link is the page content
and the second echo is the “Restricted Access Message”.

But I need do it via PHP code on another page.
I have pages:
– Main
— Subpage
I would like to check access to subpage from main page

@chefranov

.../plugins/ultimate-member/includes/core/class-access.php line 2060

UM()->access()->is_restricted( $post_id );

/**
 * Is post restricted?
 *
 * @param int $post_id
 * @param bool $on_single_page
 * @param bool $ignore_cache
 * @return bool
 */
function is_restricted( $post_id, $on_single_page = false, $ignore_cache = false ) {

It works perfect! Thank you!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer