- Posts: 59
- Thank you received: 0
Content Restrictions in Template
- AdinaG
-
Topic Author
- Offline
- Senior Member
-
Less
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
{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
- Tuan Pham Ngoc
- Offline
- Administrator
-
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
Tuan
Please Log in or Create an account to join the conversation.
- AdinaG
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 59
- Thank you received: 0
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
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.
- Tuan Pham Ngoc
- Offline
- Administrator
-
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:
Regards,
Tuan
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
-
Less
More
- Posts: 59
- Thank you received: 0
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?
<?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.
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.