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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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”.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Author: Kim Coleman
Kim Coleman is the co-founder of Paid Memberships Pro, the most trusted membership platform, which powers over 90,000 membership sites worldwide. With over two decades of experience in development, management, and marketing, Kim plays a pivotal role in shaping the product and guiding the team.
She specializes in content creation, video tutorials, and frontend development for the core open-source plugin and its various Add Ons, helping businesses of all sizes build and grow their membership sites.
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.