Title: Restricted Content Message Problem
Last modified: February 28, 2023

---

# Restricted Content Message Problem

 *  [Chris Raymond](https://wordpress.org/support/users/chrisraymond/)
 * (@chrisraymond)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/restricted-content-message-problem/)
 * Hello,
   I am using the [ithemes php](https://help.ithemes.com/hc/en-us/articles/360049324614-Restricting-Content-in-Template-Files)
   method to restrict content in my custom template. All works well, however I am
   not seeing the “Restricted Content Message” for visitors that are not logged 
   in. Instead, the restricted content is hidden without message. Here is the code
   we are using:
 *     ```wp-block-code
       <?php if ( rcp_user_has_paid_membership() ) : ?>
       	<p>Content inside here would only be visible to active paid and active free subscribers.</p>
       <?php endif; ?>
       ```
   
 * Any ideas? Thanks in advance.
    -  This topic was modified 3 years, 3 months ago by [Chris Raymond](https://wordpress.org/support/users/chrisraymond/).

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [lelandf](https://wordpress.org/support/users/lelandf/)
 * (@lelandf)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/restricted-content-message-problem/#post-16518793)
 * You could use [else](https://www.php.net/manual/en/control-structures.else.php).
   For example, something like this:
 *     ```wp-block-code
       <?php if ( rcp_user_has_paid_membership() ) : ?>
       	<p>Content inside here would only be visible to active paid and active free subscribers.</p>
       <?php else : ?>
       	<p>Content inside here would display if the above condition is not met.</p>
       <?php endif; ?>
       ```
   
 * Also, reading the sentence about “active paid and active free subscribers” are
   you sure you didn’t mean to use the rcp_user_has_active_membership function instead
   of rcp_user_has_paid_membership?
 * The rcp_user_has_paid_membership check would exclude active free subscribers.
 *  Thread Starter [Chris Raymond](https://wordpress.org/support/users/chrisraymond/)
 * (@chrisraymond)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/restricted-content-message-problem/#post-16518922)
 * Hi [@lelandf](https://wordpress.org/support/users/lelandf/) – Thanks for the 
   response, it’s much appreciated. Any idea why the custom message added within
   the Restrict content plugin is not displaying when using the php method? I don’t
   mind added a message via the template, but curious is something with my setup
   is affecting the plugins ability to render the text. Thanks again.
 *  [lelandf](https://wordpress.org/support/users/lelandf/)
 * (@lelandf)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/restricted-content-message-problem/#post-16518945)
 * Invoking the rcp_user_has_paid_membership function does not do anything other
   than return a boolean value: true or false.
 * If true, then execution within the conditional block continues. That’s when the“
   Content inside here would only be visible […]” message displays.
 * In other words, the custom message was not displaying because the code as originally
   written did not include instructions for that particular task.
 *  Thread Starter [Chris Raymond](https://wordpress.org/support/users/chrisraymond/)
 * (@chrisraymond)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/restricted-content-message-problem/#post-16519196)
 * Makes sense now, thank you for the clarification. Much appreciated.
 *  Thread Starter [Chris Raymond](https://wordpress.org/support/users/chrisraymond/)
 * (@chrisraymond)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/restricted-content-message-problem/#post-16521060)
 * [@lelandf](https://wordpress.org/support/users/lelandf/) Just to be clear, our
   issue is that we need to show the restriction message which I set in the plugin
   settings for non paying users(visitors not logged in)
 * Which does automatically populate message to pay for full content if we use short
   code in a test post. But when using our short code in custom template it’s not
   working. That’s why we wrapped our block in this condition by using that ‘rcp_user_has_paid_membership()’
   function. Using this code is working as our block is hidden for non-paying users.
 * Now the issue is that we need to show that message for non-payng users, is there
   is any function exists which can return the restriction message to which we set
   in plugin settings?
 * Or are we using the wrong function? If I am doing wrong then please let me know
   which function I need to use? Thanks again.
 *  [lelandf](https://wordpress.org/support/users/lelandf/)
 * (@lelandf)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/restricted-content-message-problem/#post-16521798)
 * You could consider simply typing the message out in the code, like in my first
   example. Saves a trip to the database, especially if the message is not going
   to ever change.
 * As for another function to dynamically retrieve the restricted content message,
   check out the rcp_get_restricted_content_message function. It’s in the core/includes/
   misc-functions.php file if you want to read it in full.
 * It’s not wrong to not use it. It’s all about how exactly you want your site to
   behave.
 * Since it sounds like you do want to dynamically pull the message, the PHP implementation
   would be something like this:
 *     ```wp-block-code
       <?php if ( rcp_user_has_paid_membership() ) : ?>
       	<p>Content inside here would only be only visible to active paid subscribers.</p>
       <?php else : ?>
       	<?php echo rcp_get_restricted_content_message(); ?>
       <?php endif; ?>
       ```
   
 * Functions are generally supposed to be single-purpose. So in this case, you’d
   just be using two functions: one to determine if the user has a paid membership,
   and one to display the restricted content message.
 *  Thread Starter [Chris Raymond](https://wordpress.org/support/users/chrisraymond/)
 * (@chrisraymond)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/restricted-content-message-problem/#post-16526503)
 * [@lelandf](https://wordpress.org/support/users/lelandf/) Thanks for this, that
   worked perfectly. Much appreciated.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Restricted Content Message Problem’ is closed to new replies.

 * ![](https://ps.w.org/restrict-content/assets/icon.svg?rev=3529325)
 * [Membership Plugin - Kadence Memberships](https://wordpress.org/plugins/restrict-content/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/restrict-content/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/restrict-content/)
 * [Active Topics](https://wordpress.org/support/plugin/restrict-content/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/restrict-content/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/restrict-content/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Chris Raymond](https://wordpress.org/support/users/chrisraymond/)
 * Last activity: [3 years, 2 months ago](https://wordpress.org/support/topic/restricted-content-message-problem/#post-16526503)
 * Status: not resolved