Assign User to Group

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.

Posted in

Comments

3 responses to “Assign User to Group”

  1. Peter Henningsen Avatar
    Peter Henningsen

    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.

    1. Eugen Bleck Avatar
      Eugen Bleck

      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 Avatar
    Eugen Bleck

    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.

Share