This code recipe adds a notification banner to remind members that their account will expire within 7 days—or any custom timeframe you would like. You can use the recipes with any WordPress theme, or specifically with a membership site using Memberlite.
About the Code Recipe
By default, Paid Memberships Pro will send members an expiration email notice 7 days prior to their expiration date (by the way, if you want to add more email expiration warnings, see our Extra Expiration Warning Emails Add On).
This recipe adds an expiration warning directly on your site, reminding the logged in member that they must renew to maintain access. The banner will only be shown to a member that has an active membership level with an expiration date within the next 7 days. You won’t need to rely on email delivery, receipt, or that your member will actually read the message.
If a member decides to renew their membership by clicking the “Click here to renew membership” link, they will be redirected to the membership levels page. From here they can select their desired membership level and proceed to checkout. They will no longer see the message.
The Code Recipe: For Memberlite
The Code Recipe: For Any WordPress Theme
Adding the Recipe to Your Website
You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.
Customizing the Recipe
You will need to adjust this code for your own site. For example, consider changing the background color of the banner by changing the “background-color” value found in the code to suit your brand colors.
You could also change the number of days from expiration that you would like the banner to appear by changing the number of
'- 7 days' value.
If you need help with tweaking this code, get in touch with our support team.