Title: API Restrict User Access
Last modified: March 17, 2024

---

# API Restrict User Access

 *  Resolved [dimizu](https://wordpress.org/support/users/dimizu/)
 * (@dimizu)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/api-restrict-user-access/)
 * First of all, thanks for the great plugin!
 * I am using Restrict User Access version 2.2.23 with WordPress 6.4.3 and PHP 7.4.
 * Now I am trying to use your API.
 * This works:
   $wp_user=new WP_User(2);$rua_user=rua_get_user($wp_user);$rua_level
   =rua_get_level(83);$rua_level_by_name=rua_get_level_by_name(“k01”);
 * But this:
   $rua_level_members=rua_get_level_members($rua_level);$rua_level_cap
   =rua_get_level_cap(83);$rua_level_members=rua_get_level_members($rua_level);
 * Does not work.
 * I get
   PHP Fatal Error: Uncaught error: Class ‘WPCAMeta’ not found in …\wp-content\
   plugins\restrict-user-access\level.php:334
 * I’m not sure if I’m using your API incorrectly. Can you give me 1 or 2 working
   examples?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [dimizu](https://wordpress.org/support/users/dimizu/)
 * (@dimizu)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/api-restrict-user-access/#post-17507684)
 * Sorry: Restrict User Access version 2.2.23 it’s wrong, it is Version 2.6.1
 *  Plugin Author [Joachim Jensen](https://wordpress.org/support/users/intoxstudio/)
 * (@intoxstudio)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/api-restrict-user-access/#post-17538709)
 * Hi,
 * Your use of the API looks correct to me. However, there is currently a limitation
   in the API so (parts of it) are only available _after_ the WP action “plugins_loaded”
   has finished.
 * The error you are seeing basically means that it’s expecting a dependency that
   hasn’t been loaded yet.
 * Can you give me some more details about what you’re trying to use the API for?
 *  Thread Starter [dimizu](https://wordpress.org/support/users/dimizu/)
 * (@dimizu)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/api-restrict-user-access/#post-17655271)
 * I have been testing your plugin for a client project. But in the end I created
   the project without your plugin. But I appreciate your feedback. Maybe I will
   use your plugin in the future.
   Thanks for the feedback.I understand your answer:“
   after the WP action plugins_loaded has finished”. I will keep it in mind.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘API Restrict User Access’ is closed to new replies.

 * ![](https://ps.w.org/restrict-user-access/assets/icon-256x256.png?rev=1815922)
 * [Restrict User Access - Ultimate Membership & Content Protection](https://wordpress.org/plugins/restrict-user-access/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/restrict-user-access/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/restrict-user-access/)
 * [Active Topics](https://wordpress.org/support/plugin/restrict-user-access/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/restrict-user-access/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/restrict-user-access/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [dimizu](https://wordpress.org/support/users/dimizu/)
 * Last activity: [2 years, 1 month ago](https://wordpress.org/support/topic/api-restrict-user-access/#post-17655271)
 * Status: resolved