rcp_user_has_access()

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.