post

How to apply coupon automatically on WPMU membership2 checkout

Membership 2 is an awesome plugin to sell your content. That being said, you can charge your members to see your site content.

If you want to give discount, you can use Coupon addon. You have to enable from Membership 2 > Addons and then you can create coupons and share with your users. Today I will show you a trick to share coupon embedded with URL. You can share your URl like domain.com/?coupon=XXXX and the XXXX coupon will be automatically applied on checkout. Read More

post

Assign and withdraw role on an user based on WPMU Membership2

WPMU Membership2 plugin has an addon that you can use to assign extra capabilities to an user when he joins in a membership, and when the user left the membership the capabilities are withdrawn. But, the problem is, even it says “Assign role”, it doesn’t assign role to that users but just assign the capabilities of that role.

So, if you need members of certain role, you won’t get those members in the member list. Even, if you have other plugin that makes some operation based on role, won’t work here. Let’s find a solution.

The following snippet will allow you to set different role based on membership, you will need to know membership IDs though. In the following example, if ID is 1343, I want to assign those users “editor” role, “author” for 1345 and “administrator” for 1348. Take a look: Read More

post

Assign a membership to a registered member automatically – Membership 2 (WPMU)

WPMU DEV has released the new revamped version for membership plugin, called Membership 2. The layout and interface is awesome of the plugin and I am personally impressed. There is a new type of membership introduced in the plugin – Default Membership. This membership will work for the user who are just registered but didn’t choose any membership to join.

But what if you want to assign a regular membership to that user? Here is a simple code snippet that will help you to do this job:

Just make sure you change to correct membership ID for $membership_id variable.

You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name ‘mu-plugins’. If there is no folder in that name, then create a folder, name it ‘mu-plugins’, create a file inside that, give any name you like and paste the code in there. You don’t need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

post

How to add an user into a BuddyPress group automatically when he joins in a WPMU membership

This is an useful snippet that will add your newly registered (via WPMU DEV Membership 2) member to corresponding BuddyPress group.

You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name ‘mu-plugins’. If there is no folder in that name, then create a folder, name it ‘mu-plugins’, create a file inside that, give any name you like and paste the code in there. You don’t need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.