Skip to content

Instantly share code, notes, and snippets.

@ipokkel
Created January 19, 2021 05:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipokkel/d0c5cee81e204cb11261491d43a7d7aa to your computer and use it in GitHub Desktop.
Save ipokkel/d0c5cee81e204cb11261491d43a7d7aa to your computer and use it in GitHub Desktop.
A multi-paragraph example of not-logged in text for restricted content.
<?php
/**
* This recipe is an example on setting a custom message for not logged in
* users when visiting a page containing restricted content.
*
* 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.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_not_logged_in_text_filter_1611033200259( $text ) {
$text = '<h3>My Heading</h3>';
$text .= '<p class="classname-here">Dolor morbi non arcu risus quis. Fringilla urna porttitor rhoncus dolor purus non enim praesent elementum. Enim diam vulputate ut pharetra. Integer feugiat scelerisque varius morbi enim nunc faucibus. Feugiat scelerisque varius morbi enim nunc faucibus a. In nisl nisi scelerisque eu ultrices vitae auctor eu. Volutpat consequat mauris nunc congue nisi vitae suscipit tellu</p>';
$text .= '<p>Tellus integer feugiat scelerisque varius morbi enim nunc faucibus a. Lacus viverra vitae congue eu consequat. Fermentum et sollicitudin ac orci phasellus egestas tellus rutrum. Sit amet massa vitae tortor. Feugiat nisl pretium fusce id velit ut tortor. </p>';
$text .= '<p>This content is for !!levels!! members only.<br /><a href="!!login_page_url!!?redirect_to=!!referrer!!">Login</a> <a href="!!levels_page_url!!">Join Now</a></p>';
return $text;
}
add_filter( 'pmpro_not_logged_in_text_filter', 'my_pmpro_not_logged_in_text_filter_1611033200259', 5 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment