rcp_user_has_access()

Note: This is part of the developer docs and is considered custom code.
Unfortunately, we cannot provide support for custom code at this time as we do not have the additional resources that would be necessary to provide support for custom code. 

If you need assistance with this, please reach out to our list of consultants for further assistance:
https://codeable.io/developers/restrict-content-pro/
rcp_user_has_access( $user_id = 0, $access_level_needed )
This function checks if the supplied user has the supplied access level. For more information about access levels, see  How do access levels work?
If you want to check to see if a given user has permission to access a given post, you’d want to use rcp_user_can_access() instead (careful, they have similar names!).
Parameters:

$user_id (int) (optional) – ID of the user to check (optional). If no user ID is supplied (or if set to 0) then the function will check the ID of the currently logged-in user.

$access_level_needed (int) – A numerical access level, like 1, 2, 3, or 5.

Return values:

true if the user has a subscription that grants them an access level equal to or higher than $access_level_needed. Will also return true if the $user_id supplied has the manage_options capability (usually administrators only).

false if the user does not have the required access level.

Have more questions?

Submit a request