• Skip to primary navigation
  • Skip to main content
OsomCode

OsomCode

Awesome code tutorials for WordPress and Genesis

  • Subscribe
  • My account
    • Edit profile
    • Favorites
    • Update credit card
  • Login

Execute an action when a user subscribes to Restrict Content Pro

Discover in this tutorial how to detect when a user subscribes (or changes subscription level) to Restrict Content Pro to execute an action.

If you use the Restrict Content Pro plugin to manage the content of a membership you may be interested in executing certain actions when a subscriber signs up or changes subscription level.

Let’s see how you can do this:

Snippet to perform an action when a user subscribes to Restrict Content Pro

Add the following code at the end of functions.php or in your functionality plugin:

To see this and another 847 code snippets of this website, login or subscribe here.

In this snippet you use the Restrict Content Pro hooks rcp_new_membership_added and rcp_membership_post_activate to execute the action you want when a new subscription or new activation is detected (which can be for a subscription level change).

You only need to add the code that you want to be executed.

Applied to a concrete example it would be something like this:

To see this and another 847 code snippets of this website, login or subscribe here.

In this example, you define a URL that you want to be visited every time the requirement is met. This can be interesting if you want, for example, to synchronize Restrict Content Pro data with an external application.

But the idea is that you execute the action that you or your client needs.

Conclusions

Now you know how to execute an action when a new Restrict Content Pro subscription is created with a little bit of code.

Any questions? I read you in the comments.

And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉

PHP Restrict Content Pro

To leave read and make questions about this code, you can login or register.

  • About OsomCode
  • FAQ
  • Contact

Legal Notice · Privacy Policy · Cookie Policy · Terms and conditions
Copyright © 2023

Lost your password?