This post covers some options for customizing the message a non-member (either logged in or logged out) sees when trying to access a piece of members-only content.


Customizing the Default Messages

In your WordPress admin, navigate to Memberships > Settings > Advanced Settings. Locate the “Message Settings” section and you will see three separate message customization options:

  • Message for Logged-in Non-members
    This message replaces the post content for non-members. Available variables: !!levels!!, !!referrer!!, and !!levels_page_url!!
  • Message for Logged-out Users
    This message replaces the post content for logged-out visitors. Available variables: !!levels!!, !!referrer!!, !!login_page_url!! and !!levels_page_url!!
  • Message for RSS Feed
    This message replaces the post content in RSS feeds. Available variable: !!levels!!

These messages will show on the single page/post as well as in the index/search/archive view if you have the setting Filter searches and archives? set to Yes. For more information about excerpts, please read the full guide on Excerpts and the “Read More” tag for Posts and Pages.


Custom HTML for Displaying the Message

You can use full HTML within the message fields if you want to add your theme’s custom message or button classes, or use any other HTML tags in the content. The message will be output in your page using the HTML markup below by default:

<div class="pmpro_content_message">
//custom message here
</div>

You can add custom CSS to your site to target this div using one of the methods outline in this guide. For example, if you are using Elementor you may see that this message displays at the full width of your page. You can use custom CSS like the following to give the content a subtle grey background and set a maximum width:

.pmpro_content_message {
	background: #F1F1F1;
	margin: 0 auto;
	max-width: 700px;
	padding: 15px;
}

Using Advanced Filters

On our site, we override this setting with a custom function. Here are two code recipes that you will need to customize to show a unique message based on the logged-in user’s membership level or for a not logged in visitor.

This code recipe requires a PMPro Plus Account or higher.

View Membership Options

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.

Then modify the level IDs and messages for your needs.

Comments (11)

Hi

I’ve recently installed this plugin and the message to logged out users that don’t have the subscription isn’t working. I’ve updated the html in the box and the end user still gets the default page.

The same html has been used in the logged in user box and that works fine.

Please can you advise why this is happening?

Regards

Hi Kimberly –

Is there any way to format how the levels appear in the message when using the !!levels!! code? It would be great if there were an Oxford comma (a comma following the second-to-last item, before the “and) in the message.

In other words, currently, if there are three levels that can access a page, the default !!levels!! code will display “A, B and C” levels.

But it would be great to change it to “A,B, and C” levels. The reason I’m asking is that, in our instance, the two highest levels are “Journal Online” and “Journal Online and Print,” so altogether the message reads:

“This content is accessible to current members of the International Neuropsychoanalysis Society at the Student, Journal Online and Journal Online and Print levels.“

This makes it look like there is possibly a repetition of words, instead of two distinct levels.

I realize this is a pretty tiny thing but it’s something to put on a wish list 🙂

Best,
Maggie

Is it possible to use a shortcode to make this message show up inside a custom page built using a builder (I use Divi for my whole site)?

When I just leave it as the default, there’s no styling at all, so it’s just plain text with no padding on an empty page.

I could code it in the Advanced Settings as shown above, but it would be a lot easier for me to just drop that message/button into a code block in Divi!

For now you can add custom CSS for these messages at the theme or Customizer level. We do not currently have a way for Divi to insert this content, or a shortcode method to insert the message. If you open a ticket about this in the Members Support area we can help you find the best fit to customize this for your site.

Hi @rwiki,

Thanks for the update on this, would you mind reaching out to our Support Team so that they can take a closer look into this for you? In the meantime, I will see if I can get Kim to take a closer look at this code recipe.

Hi there,

Are you able to try to disable and reactivate the plugin to see if this fixes the issue? Keep in mind that deleting the plugin will cause you to lose all your PMPro data and will need to start from the beginning. Just keep note of this.

Leave a Reply

For faster support related to issues on your specific site please open a ticket in our members support area.

Your email address will not be published. Required fields are marked *