Please or Register to create posts and topics.

Move users with purchased Membership to usergroup Automatically

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:
  • lets-talk.png

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 );

 

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Slightly confused. Do you mean ask the developer of the WooCommerce plugin?

Which php file should this code be placed and where?

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.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

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?

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.

Need professional help with Asgaros Forum? Book an appointment with us at domra Web Solutions for setup and customization services. Learn more about our Toolbox for Asgaros Forum plugin to enhance your forum experience.