Support » Plugin: Groups » Get group name by id

  • Resolved figment


    Hi. I’m doing some complex export of meta data info for my site, and I need the name of the groups the user is assign. Right now I have the group_ids but I can’t find a function or something to convert them to their names. Its not in documentation, nor I can find it here. So how can I get the NAMES of the group the user belongs to?

    $groups_user = new Groups_User($user_id);
    $user_group_ids = $groups_user->group_ids;

    result is

    1: ‘6’

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    You can use something similar and retrieve the groups instead of the group ids, unless this is absolutely necessary for you.
    For example:

    $groups_user = new Groups_User($user_id);
    $user_group_ids = $groups_user->groups;

    This will return an array of groups objects that contain the group name among other properties of the group.

    Kind regards,

    Thread Starter figment


    Of course. Thank you so much.

    You’re welcome

    Plugin Author Kento


    FYI the documentation has some Examples which you might find useful, that’s located in the API section of the documentation

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Get group name by id’ is closed to new replies.