Title: Developer API&#8217;s and Data Location
Last modified: June 28, 2019

---

# Developer API’s and Data Location

 *  Resolved [atlabs](https://wordpress.org/support/users/atlabs/)
 * (@atlabs)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/developer-apis-and-data-location/)
 * Hello,
 * I need assistance with the developer API’s. I am new to WordPress programming.
 * I am trying to put a user into a certain group once they register, but the group
   they get access to is based on their domain name. I believe I have that part 
   figured out, but I’m not sure what code to use to add a user to a specific group
   for this plug-in.
 * The developer API I believe I would use is “add_level(int $level_id):bool”, but
   I’m not sure what to put for the $level_id. Also I’m not sure if I’m supposed
   to replace “bool” with True or False (for Boolean).
 * I have five groups that a user could be put into. Platinum, Gold, Silver, Bronze
   and Blocked.
 * Also I was having trouble finding the data that shows what group a user is in(
   in the database). That would also be useful information.
 * Thank you.

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

 *  [UnchartedDesign](https://wordpress.org/support/users/uncharteddesign/)
 * (@uncharteddesign)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/developer-apis-and-data-location/#post-11708776)
 * Okay so you need the user ID, and the group ID. You can see the group ID in the
   URL when you’re editing the level. Or, you can get it by calling rua_get_level_by_name(
   $slug) where $slug is ‘my-formatted-level-name’
 * You’ll want to hook into the authorization or login hook, grab the user’s ID 
   and put them in a group.
 *     ```
        $user = rua_get_user(get_current_user_id());
       $level = rua_get_level_by_name('platinum');
       $user->add_level($level->ID); 
       ```
   
 * The access level is stored in the usermeta table, meta key _ca_level
 * Reference:
    [https://developer.wordpress.org/reference/functions/get_current_user_id/](https://developer.wordpress.org/reference/functions/get_current_user_id/)
   [https://codex.wordpress.org/Plugin_API/Action_Reference/wp_login](https://codex.wordpress.org/Plugin_API/Action_Reference/wp_login)
 *  Plugin Author [Joachim Jensen](https://wordpress.org/support/users/intoxstudio/)
 * (@intoxstudio)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/developer-apis-and-data-location/#post-11716356)
 * Thank you for your input [@uncharteddesign](https://wordpress.org/support/users/uncharteddesign/)!
   Appreciate your help.
 * [@atlabs](https://wordpress.org/support/users/atlabs/)
 * When you see a method referenced like `add_level(int $level_id):bool`, `int` 
   means that the type of $level_id should be an integer, and `:bool` means that
   you can expect the method to return true/false. Because PHP by default is weakly
   typed, you will not get errors if `$level_id` e.g. is a numeric string (“1” instead
   of 1).
 * I hope this helps!

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

The topic ‘Developer API’s and Data Location’ 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/)

## Tags

 * [code](https://wordpress.org/support/topic-tag/code/)
 * [question](https://wordpress.org/support/topic-tag/question/)

 * 2 replies
 * 3 participants
 * Last reply from: [Joachim Jensen](https://wordpress.org/support/users/intoxstudio/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/developer-apis-and-data-location/#post-11716356)
 * Status: resolved