Move users with purchased Membership to usergroup Automatically
Quote from mgraham9 on December 4, 2018, 8:38 pmHey there,
The forum plugin is fantastic…
The only issue i have is that my customer has “Membership’s” options on the website to use certain plugins on the site (listings, event calenders, forum, etc)
Customer wants a “members” only section in the forum so that only users with memberships can use it.. I know you can make usergroups, but is there a way to automatically add users who purchase memberships from the website to the group?
Thanks
Hey there,
The forum plugin is fantastic…
The only issue i have is that my customer has “Membership’s” options on the website to use certain plugins on the site (listings, event calenders, forum, etc)
Customer wants a “members” only section in the forum so that only users with memberships can use it.. I know you can make usergroups, but is there a way to automatically add users who purchase memberships from the website to the group?
Thanks
Uploaded files:Quote from Asgaros on December 4, 2018, 8:45 pmHello @mgraham9
This requires a custom-implementation. What you need is a hook/action which is fired after an user successful purchased a membership. I guess the plugin which you are using has such hooks or an official API – so first you need to ask the developer of check the documentation about which hook you can use.
When you know the hook you can use the following Asgaros Forum function inside that hook to add an user to a specific group:
// The ID of the user. $user_id = 123; // The IDs of the usergroups. $group_ids = array(13, 37); // Add user to group(s). AsgarosForumUserGroups::insertUserGroupsOfUsers($user_id, $group_ids );
Hello @mgraham9
This requires a custom-implementation. What you need is a hook/action which is fired after an user successful purchased a membership. I guess the plugin which you are using has such hooks or an official API – so first you need to ask the developer of check the documentation about which hook you can use.
When you know the hook you can use the following Asgaros Forum function inside that hook to add an user to a specific group:
// The ID of the user. $user_id = 123; // The IDs of the usergroups. $group_ids = array(13, 37); // Add user to group(s). AsgarosForumUserGroups::insertUserGroupsOfUsers($user_id, $group_ids );
Quote from mgraham9 on December 4, 2018, 8:49 pmSlightly confused. Do you mean ask the developer of the WooCommerce plugin?
Which php file should this code be placed and where?
Slightly confused. Do you mean ask the developer of the WooCommerce plugin?
Which php file should this code be placed and where?
Quote from Asgaros on December 4, 2018, 8:55 pmYes, if you use WooCommerce, they can give you more information about it. I dont know WooCommerce and its code, so they can tell you which of their action-hooks you can use and how they work.
You can place the final code into your themesĀ functions.php-file.
Yes, if you use WooCommerce, they can give you more information about it. I dont know WooCommerce and its code, so they can tell you which of their action-hooks you can use and how they work.
You can place the final code into your themesĀ functions.php-file.
Quote from biska7 on September 18, 2020, 5:00 pmHello!
I know that this is old topic but I have similar problem. I need members buy Membership and receive access to hidden forum! Or just buy access to forum!
I’m using myCRED plugin + MicroPayments plugin. It is possible to buy in MicroPayments something and usergroup will change. But not possible to change usergroup of Asgaros forum…
Is there some way to sell with myCRED access to asgaros forum?
Hello!
I know that this is old topic but I have similar problem. I need members buy Membership and receive access to hidden forum! Or just buy access to forum!
I’m using myCRED plugin + MicroPayments plugin. It is possible to buy in MicroPayments something and usergroup will change. But not possible to change usergroup of Asgaros forum…
Is there some way to sell with myCRED access to asgaros forum?
Quote from qualmy91 on September 21, 2020, 6:52 amHey @biska7,
it would be the same procedure like @asgaros explained before. You have to know the hook of myCRED or MicroPayments that you can use for it. So you should ask their developers for your help.
After that you can use the code above to change the usergroup of Asgaros Forum.
Hey @biska7,
it would be the same procedure like @asgaros explained before. You have to know the hook of myCRED or MicroPayments that you can use for it. So you should ask their developers for your help.
After that you can use the code above to change the usergroup of Asgaros Forum.

