Find out in this tutorial how to add a link that directs to the Restrict Content Pro customer page from the WordPress user panel using code.
If you have a membership site created with Restrict Content Pro it is likely that more than once you go from Users to Customers and vice versa. Especially if you use the User Switching plugin to check how the subscriber sees the content.
So, being able to access the customer page from the users section can be very practical and save you time.
The good news is that with a little bit of code you can achieve this:
Let’s see how:
Snippet to insert a link on WordPress users leading to their customer tabs in Restrict Content Pro
Add the following code at the end of functions.php or in your functionality plugin:
To see this and another 1097 code snippets of this website, login or subscribe here.
With this snippet you use the user_row_actions
filter to display a link on WordPress users that allows you to go directly to their Restrict Content Pro client tab.
You also use the rcp_get_customer_by_user_id
function to get the RCP_Customer
object and extract the necessary customer information (the ID in this case).
Also, thanks to the conditionals you use, the link will be shown only to users who have a customer created with Restrict Content Pro.
Finally, you can change the “Go to customer file” text to whatever you prefer.
Conclusions
Now you know how to display a link to the Restrict Content Pro customer page on WordPress users with a little bit of code.
Any questions? Let me know 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. 😉