G
G
GoggleMoggle2021-06-08 16:14:58
WordPress
GoggleMoggle, 2021-06-08 16:14:58

How to restrict content by member in WordPress?

Hello, can you advise a plugin with which you could give access to a specific page, a specific user (lyam).

In more detail, I’m making a website for the game, I created a custom type of hint post, the page itself is collected by the administrator via acf, but I want the hint pages themselves to be available not to everyone, but only to those who were given access to the admin panel. If the first stage is completed correctly, the manager gives access to the second hint, and so on.
+ display a list of all pages that are available to the user so that they do not have to search for them in the browser history.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
GoggleMoggle, 2021-06-08
@GoggleMoggle

I tried different plugins, but everywhere there was a restriction on a group of users, and not on a specific user in the system

A
Artem Zolin, 2021-06-12
@artzolin

I won’t tell you the plugin, but it’s easy to do it through the same acf. Create a select for the user, when displaying content, check that the user is registered and has the appropriate access level

$user_id = 9;
$key = 'user_access';
$user_access = get_user_meta( $user_id, $key, true );

if ( is_user_logged_in() && $user_access == 'level_two' ) {
  # code...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question