Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Last active July 8, 2021 17:35
Show Gist options
  • Save strangerstudios/7372367 to your computer and use it in GitHub Desktop.
Save strangerstudios/7372367 to your computer and use it in GitHub Desktop.
Use a filter to adjust the content of the user page that is created with PMPro and the User Pages addon.
<?php
/*
When the user page is created, add some content.
*/
function my_pmpro_user_page_purchase_postdata_content($postdata, $user, $level)
{
//update post content
$postdata['post_content'] = "<p>Thank you for using our site.</p>
<p>This is some extra content for the user page.</p>
<p>We got links:</p>
<ul style='margin-bottom: 3em;'>
<li><a href='" . home_url() . "'>Homepage</a></li>
<li><a href='" . home_url("/members/") . "'>Members Area</a></li>
<li><a href='" . home_url("/contact/") . "'>Contact Us</a></li>
</ul>";
return $postdata;
}
add_filter("pmpro_user_page_purchase_postdata", "my_pmpro_user_page_purchase_postdata_content", 10, 3);
?>
@laurenhagan0306
Copy link

This recipe is included in the blog post on "Setting Default Page Content or Page Template with the User Pages Add On" at Paid Memberships Pro here: https://www.paidmembershipspro.com/setting-the-default-page-content-or-page-template-with-the-user-pages-add-on/

@kimwhite
Copy link

kimwhite commented Jul 8, 2021

I have forked this to allow for multiple levels
https://gist.github.com/kimwhite/5e16208b33a725422203798c499c63b9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment