In this post, I explain an optimal way to integrate USP Pro with an e-commerce (ecommerce) plugin, and also provide some examples to illustrate how it works. It’s a question that I get asked from time to time, so hopefully posting the information here will help shed some light for those who are interested. Read on to learn more..

Question

Here is a variation of the type of question that people are asking about USP Pro:

What’s the best way to require users to pay before submitting a post with USP Pro?

In other words, some users want to know how to go about combining USP Pro with a membership or eCommerce plugin in order to set up pay-per-post functionality on the frontend.

Answer

USP Pro focuses on front-end forms and is 100% compatible with any e-commerce or membership plugin that is written according to the WordPress API. Basically the idea is to use USP Pro for the forms, and a good membership plugin to collect payments and control access. This is an ideal setup, as each plugin can focus on what it does best, giving you maximum control, flexibility, and performance.

For example, what most customers do is use USP Pro to set up one or more front-end forms and display them on specific pages. Then they install and configure a membership plugin (e.g., s2member or similar) to collect payments and restrict which of the form pages can be accessed by which users. Most membership plugins are well-suited for controlling access to specific pages based on purchase or membership level. So with that, you can create and customize any number of USP Forms and add them to your pages as you see fit.

Example #1

To get an idea of how this works, you could set up a post-submission form for logged-in/registered users, and a login/register form for users who are not logged in or have not yet registered. You then could use USP Shortcodes to display one form or the other, depending on whether the user is logged in or not. Here is an example:

[usp_visitor]
	The user is not logged in, so display the login/register form:
	[usp_login_form]
[/usp_visitor]

[usp_member]
	The user is logged in, so display a post-submission form:
	[usp_form id="submit"]
[/usp_member]

This shortcode configuration first checks if the user is a visitor (not registered and logged in). If so, then the Login/Register Form is displayed, so the visitor can login and/or register. Then the next set of shortcodes checks if the user is a member (registered and logged in). If so, then a post-submission form is displayed, so the member can submit content to the site.

Pro Tip: any [usp_form] that you want to display via shortcode must be published (not draft or pending).

USP Pro provides other shortcodes that could be used to set up more advanced configurations, such that members can access forms based on their specific role (e.g., Administrator, Editor, Author, et al). Check out the resource links at the end of this article for more information.

Example #2

Another example could use member shortcodes provided by the membership/e-commerce plugin of your choice. There are many great plugins available, for example the free version of s2member provides a wealth of flexible conditional shortcodes. So you could combine the membership shortcodes and the USP shortcodes, for example:

[s2If !current_user_can(access_s2member_level1)]
	The user is not logged in, so display the login/register form:
	[usp_login_form]
[/s2If]

[s2If current_user_can(access_s2member_level1)]
	The user is logged in with an s2Member Level >= 1, so display the submission form:
	[usp_form id="submit"]
[/s2If]

This shortcode configuration checks to see if the visitor has paid for “level 1” access. If they have, a post-submission form is displayed. Otherwise, if they do not have access, the login/registration form is displayed.

This configuration could be customized to check for any level of access and display any form that is desired. Further, you could set up any number of forms and allow access based on whichever criteria are desired, login status, membership level, user role, and so forth.

More information

If you have any questions about the ideas presented in this article, feel free to drop a line anytime, we’re always glad to help.

Keywords: ecommerce, e-commerce, shopping cart, membership plugin

Resources