itthinx / groups

Groups provides group-based user membership management, group-based capabilities and content access control. It integrates standard WordPress capabilities and application-specific capabilities along with an extensive API.
GNU General Public License v3.0
49 stars 35 forks source link

Automatically assign a role to a a group in woocommerce #150

Closed MikaBean closed 5 months ago

MikaBean commented 5 months ago

Hello, I've seen that this question has been asked already, but I need more information. I would like to automatically a specific role to a specific group. Can you help me ? I've tried different shortcodes like [groups_join role="GSS"] but none of them worked.

Thank you for advance

MikaBean commented 5 months ago

Hello Itthinx, can you provide me an answer please ? Have a nice day

itthinx commented 5 months ago

Hi,

You cannot assign a role to a group. Within the design principles that Groups is based on, this would not be conceptually sound. However, you might find a solution like https://github.com/itthinx/groups-role-registration useful, that adds a user to a group based on role, a group named after the role is created automatically if needed.

Note that you will not be able to achieve this with any shortcode. The example you give is using a shortcode parameter which does not exist - see https://docs.itthinx.com/document/groups/shortcodes/groups_join/ for details on the supported parameters.

If you would like to add a role to a user as soon as a user is added to a particular group, you could use the groups_created_user_group action to implement the assignment.

As you can see, this will require a certain amount of coding, but if you are familiar with WordPress it's quite easy to do.

Cheers!

itthinx commented 5 months ago

(resolved as above)