Here are two code recipes demonstrating the pmpro_user_page_purchase_postdata
filter for the User Pages Add On. This add on creates a unique, private page for the member at checkout, a useful way for you to share personalized content on a per-member basis.
The recipes show how to set default post content and a page template for the created page.
Filter the Created Page’s Content
Use this recipe to adjust the content of the user page that is created. The default content of the created page is: Thank you for your purchase. This page will be updated soon with updates on your order.
Copy and paste this code recipe into a helper PMPro Customizations plugin. Update the $postdata['post_content']
value with your desired content.
Filter the Created Page’s Template
Use this recipe to adjust the template of the user page that is created. The default template of the created page is your theme’s “Default Layout”.
Copy and paste this code recipe into a helper PMPro Customizations plugin. Update the $postdata['page_template']
value with your desired templates. You can remove the level checks if you only have one type of page template you would like to assign.
A Note about the User Pages Add On
This add on creates a “parent” page for each member, and when a membership checkout is completed, the unique User Page for that membership level is added as a child page of the member’s page. If you would like to filter the default content of the “parent” page for the user, use the pmpro_user_page_postdata
filter instead.
As always we offer support for this code recipe via the members forum. Just open a new topic and we will help you get your User Pages Add On set up appropriately.
Free Course: Membership Site Development—The Basics
Develop a deeper understanding of membership site development in this beginner-level course. Learn how to make your site work better, save yourself time and money, and improve your site's performance.