Content Restrictions in Template

  • AdinaG
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 8 months ago #148478 by AdinaG
Content Restrictions in Template was created by AdinaG
Can you tell me how I might be able to insert the code for the content restrictions inside of the actual detail page template?

{mprestriction ids="PLAN_IDS"}CONTENT_WANT_TO_RESTRICT{/mprestriction} 

I have several things that will be added to the template that will be inside of this restricted area. 

This is what I have right now in my detail.thtml page

{mprestriction ids="1"}
            <?php echo $listing !== strip_tags($listing) ? $listing : nl2br($listing);?>
{/mprestriction}

The is what is displaying on the site.
 

What do I need to put around the  {mprestriction ids="1"} and {/mprestriction} in order for them not to display as text and it still functions properly?

Thanks in advanced!

Adina

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago #148488 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Content Restrictions in Template
Sorry Adina. I don't really understand your question. Could you please explain more details? Exactly what you are trying to do?

Tuan

Please Log in or Create an account to join the conversation.

  • AdinaG
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 8 months ago #148502 by AdinaG
Replied by AdinaG on topic Content Restrictions in Template
Hi... sure

I am using the JReviews extension and will have custom fields and sections within the detail page that will only be available to clients who a certain paid access levels.

JReviews can hide these fields automatically but does not tell them to purchase the subscription.

The {mprestriction ids="1"} {/mprestriction} works within the html editor, but I want the same functionality but instead have it coded into the custom detail page within JReviews.

Is there a way to do that, something to wrap around the fields/sections?

Hope that makes better sense...

Thank you!

Adina

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago #148515 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Content Restrictions in Template
I don't know if it is possible. But you can try something like this:
Code:
ob_start(); // The code to output the content you want to protect here $codeOuput = ob_get_clean(); echo JHtml::_('content.prepare', '{mprestriction ids="1"}' . $codeOuput . '{/mprestriction}');

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • AdinaG
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 8 months ago #148577 by AdinaG
Replied by AdinaG on topic Content Restrictions in Template
So I figured out how to get it to display the message with this

        <?php echo JHtml::_('content.prepare', '{mprestriction ids="1"}' . $codeOuput . '{/mprestriction}'); ?>    

but cant seem to figure out how to get it to wrap around what information I want to restrict.... Sorry I dont write code... 

Any suggestions?

Please Log in or Create an account to join the conversation.