Monetizing community and multivendor sites, adding member subscriptions and restricted access

Today, we will discuss some ways how you can monetize your communities, directory and multivendor sites. You can use this for BuddyPress sites, for sites where users can submit posts, multivendor sites where users sell something. We will show you some tricks and extended function, combinations with membership plugins, WC Vendor, Buddypress, reputation system.

THIS ARTICLE IS OUTDATED NOW. FROM 6.7 OF REHUB FRAMEWORK, YOU DON’T NEED ANY CODE AS ALL CAN BE SET FROM ADMIN PANEL. Read article

First of all, in our article we will use S2Member plugin. We found that this is one of the best membership plugins, because it has many functions, developer friendly and has paypal button and url access even in free version.

Basic settings for S2Member

After installing, you can go to S2Member – Getting Started to check some docs. Most important parts for setting are welcome page, registration page and membership options page.

S2Member has very powerful conditional shortcodes, which can help to show content for different roles and capabilities. Also, S2Get shortcode can be useful to show some info about current user

Welcome page (S2 Member – General settings – Login Welcome page) is page which will be used after user logged on site. This page will be visible also for free subscription users, so, make this page informative and add messages how users can control their memberships, add benefits of paid subscription and links on page where they can update their membership (membership option page). It’s also good to add some plugin shortcodes to this page, which adds ability to change profile data. Default plugin shortcode for this is

Important!!! S2Member plugin adds redirect to vendor page on wp_signon wordpress function. In most cases, if your theme or plugin has login popup, it will not work with S2Member. For WPsoul themes we added option to change login popup to static button for login/register. Theme option – Header – Type url for login button. Use there link for your registration page

Usually, I use tabs on welcome page. Each tab has some logical part. For example, in one tab you can add information how to buy extended membership account, on another, you can add special shortcode of plugin which adds profile form Find tab shortcode in your theme. Wpsoul themes has next shortcode example which can help

Registration page. By default, S2member uses standard wordpress login/register page. You can also customize it in S2Member – General Option – Login/Registration design. In very common cases, you will want to use frontend register page. Many plugins add own register page. For Buddypress, you can control such page in Settings – Buddypress – Pages. For multivendor sites, it’s better to use woocommerce register page. You can find it in Woocommerce – Settings – Accounts. Both plugin’s form are supported by S2Member. You can add additional fields to form which will be saved to user meta. S2Member also synchronized it’s roles with BuddyPress. For WC Vendor and woocommerce synchronization – please, read information below.

By default, S2Member plugin also adds additional fields for name to register form – you can prevent this in S2Member – General Option – Registration/Profile Fields & Options

You can also want to totally hide wp-admin pages from users in S2Member – General Option – Member Profile Modifications

Membership options. This page will be in use when user will try to get restricted content and when he want to buy access or subscription. It’s also very important to have good and clear information what user will get after payment and what benefits he will get. Don’t forget to add all conditions for payment and contact details if user will have a problem. You also need to create all buttons for purchases in S2member – Paypal settings (or in PRO forms for pro version). Also, don’t forget to create cancel subscription button

Also, it’s good point when you place price table on this page. In our theme we have bundled shortcode for this which supports custom buttons. This is example of such shortcode

levelaccess

Also, note, that after registration from woocommerce form, users will be redirected to vendor dashboard in theme. To prevent this – disable this in theme option – shop settings – WC Vendor setting

Combine your content shortcodes with S2 conditional shortcodes to show different content and options for different user roles and you will get the best member option page.

It’s also a good idea to load css and js of S2member only on their pages. Check S2Member – General Option – Lazy loading

Now, when all most important pages are ready, it’s time to give you some extended snippets and ideas.

All snippets must be added in the end functions.php file of theme or child theme (before closed ?> tag if you have it). Don’t forget that you should add this code also after each update of theme

back to menu ↑

Synchronization WC Vendor roles and S2Member

By default, WC Vendor has 2 roles – pending_vendor (when you have user moderation) and vendor role. One of the problem is that S2member requires to use own roles to handle with permissions. These roles are

s2member_level1, s2member_level2, s2member_level3, s2member_level4

Also, there is virtual s2member_level0 level which is equal to Subscriber role of WordPress.

So, when you sell member level, for example, s2member_level1, after purchase, user will get this role, but vendor role will be deleted and user will lose vendor abilities.

Thank’s to GOD, WordPress has ability for multi roles, so, you can add vendor role again to paid member roles of S2member after each time when user or admin change role. Here the snippet.

Explanation. set_user_role is hook in wordpress which is triggered once user change role. So, we will use it to add vendor role to user once he get one of S2member roles.  You can also use this snippet when you want to sell Vendor role for users. All S2Member level with > 0 are paid levels, so, when user purchase level 1 or more, he will get also vendor role. You can also add snippet which makes user losing vendor role once he get downgrade to free level (for example, when his subscription will be expired).

Also, maybe you need also to hide vendor dashboard from free users. Example code will hide dashboard if user doesn’t have level 1

Also, one more useful snippet. You can add S2member role once vendor role will be applied to user from WC Vendor plugin. Code for this

back to menu ↑

How to make limited post submission for free members

One of popular requests from my buyers is question how to limit user submit. For example, you want free users to have only 5 free post submission. I will show you some snippets for my bundled RH Frontend PRO plugin. If you have another submit plugin – code will be the same, difference is only in name of hooks in plugin. You can know names from plugin’s author.

Let’s start. First of all, You need to save custom field for submit form with form ID. This will allow to count how much posts user submits from this form (you can skip this step if you want to count all posts which were submitted from plugin).

My plugin has hidden field in form with form ID. It looks like

formsub

So, name of field is form_id, and my code to save custom field for post will be

wpfepp_form_1_actions is hook which runs before form save. If you use own plugin, make sure that you use correct name of hook.

_submitformid_topost – is custom field which will store form ID

Now, let’s add some counter when post will be published

Explanation. This function will be triggered when user submission will be published. Default limit for submit is 5. Code will save this limit to _user_submit_counter_1, where 1 is ID of form which will have limits. If you want to create code to count posts from all submit forms of all plugins, set

So, code will save count to _user_submit_counter_all. After each published posts, this counter will have minus 1. So, when it was 0 – you can hide form and show something another (link on paid subscription page, etc)

Now, we can use this user data for conditional logic. In my plugin there is a hook which runs before submit form is printed on page.

This hook is wpfepp_do_before_print_form for all forms and wpfepp_do_before_1_print_form for form with ID 1 (works on version more than 3.25, if you have older version – update plugin)

So, I can add next code to limit user access to form.

When user richs it’s limit – he can’t see form. Instead of this, he will see your custom message. This code will add limit for form ID = 1. You can now create second form which is available only for member level 1 (wrap it with conditional shortcodes from S2Member) and doesn’t have limits.

back to menu ↑

Url restrictions

S2member plugin has one good feature even in free version. You can hide access by url. This is very helpful when you want restrict access to part of site. For example, you can disable access for adding profile image header in Buddypress profiles. For example, link where user can change profile photo in BuddyPress is http://site.com/members/rehubdemo/profile/change-avatar/

This links is the same for all users except rehubdemo which is user nicename. S2member supports code replacements. So, link for adding restrictions will be

http://site.com/members/%%current_user_nicename%%/profile/change-avatar/

back to menu ↑

Changing role based on MyCred reputations

This code will change user role once user gets reputation level

back to menu ↑

Additional features

There is one more extended feature in plugin. It’s Custom Caps. You can add additional custom capabilities to existed roles and sell such capability. For example, you want to sell access to special page, but you don’t want to add this to separate member role. More about Custom capabilities

If you want to setup extended membership logic and don’t want to do this yourself – contact with us. Note, that currently we create customization and setup only for our products.

 

Monetizing community and multivendor sites, adding member subscriptions and restricted access
5 (100%) 5 votes

Want to get unique wordpress tips?

We won't rent or sell or spam your email. We promise!

Tags:

Leave a Reply

5 Comments on "Monetizing community and multivendor sites, adding member subscriptions and restricted access"

Notify of
avatar
Sort by:   newest | oldest | most voted
pol
Guest

HI
Is it possible to do a plugin that will restrict limit products [woocommerce] (number of products) for each user.
I am very curious if you can help me.

I’ll be grateful for the quick response

Regards,
Pol Evening 🙂

Emmanuel
Guest

hello can i use paid membership pro with your theme

wpDiscuz