Assign User to Group

Posted in

My site shall support a type of virtual tournament.

I have a site where I need:
– users (staff/instructors) who are members of a specific staff-group
– to be able to assign other users (participants in the tournament) to specific group (bases).

How can I, with a Short Code or by PHP make a button where a given (named user) can be assigned to a Group. I know its possible to do in the user management module, but I need more simple solution, where my staff doesn’t need to access the user management.

3 Responses to Assign User to Group

  1. Peter Henningsen October 26, 2020 at 12:02 pm #

    Hi Eugen
    Thank you for your answer.
    Unfortunately this doesn’t solve all of my problem. What I need is a function like this (a way to do the same):

    [groups_join user="Y" group="X"] executed by user Z, by click on a button. But that type of functionality is not included in the Short Code.

    In the mean time I found the following in the API documentation:

    Assigning a user to a group
    Groups_User_Group::create( array( ‘user_id’ => $user_id, ‘group_id’ => $group_id ) );

    This (above) may do the job, but then the code shall be invoked from a PHP Snippet. Unfortunately I’m not that skilled in PHP and WP, so I can’t interpret how to implement it.

    • Eugen Bleck October 29, 2020 at 9:35 am #

      Hi Peter,

      Thank you so much for the update.

      You are correct to say [groups_join user="Y" group="X"] isn’t currently possible with Groups at the moment, as we don’t have the user attribute for now.

      However, in order to get something like this done, you’ll need to get someone(Web Developer) who’s skilled in PHP to have this customization done for you.

      If you have any further inquiries, please share and I’ll be more than happy to help.

      I wish you a very fine and productive day ahead.

      Be awesome!
      Kindest regards,
      Eugen.

  2. Eugen Bleck October 26, 2020 at 11:09 am #

    Hi Peter,

    I trust you are feeling awesome today and that your weekend was amazing!

    Thank you so much for reaching out and for asking your question.

    Yes, there exists a shortcode you can use to enable users to join a particular group. This is possible with the [groups_join group="X"] shortcode. Where X, is the group ID or name.

    You can read more on it here:
    * http://docs.itthinx.com/document/groups/shortcodes/groups_join/

    I wish you a very fine and productive day ahead.

    STAY SAFE and be awesome!
    Kindest regards,
    Eugen.

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account

Share