PDA

View Full Version : Hiding content in the CMS with certain conditions.


deverill2010
02-27-2012, 09:09 PM
I have a custom form in a static page in the CMS, as well as some text.

In total I will have 3 forms but two of them I don't want to be seen by unregistered users and registered users must have 5 posts or more to be able to see the form. As the form is in a static page is there any code I can wrap around the form to do what I want?

I don't really want to have to go down the route of faffing about creating a new usergroup and promotions and stuff, plus I don't want to block the whole page just the specific form bit so they can't submit untill they are registered with 5 posts or more!

I know I need to us vb conditionals but what? As I have no idea what they are.

kh99
02-28-2012, 04:12 PM
I don't think you can use template vb:if tags in a static html page. But instead of putting html in the big text area you can leave it blank and just change the template name to a template you want to use (see this article: https://vborg.vbsupport.ru/showthread.php?t=236245).

deverill2010
02-28-2012, 04:33 PM
I've sorted it thanks :) Using a vb condition.

kh99
02-28-2012, 04:51 PM
Did you put a condition right in an html static page? I thought I tried that and it didn't work.

deverill2010
02-28-2012, 04:58 PM
Na I made a copy of the template it calls and renamed it, and put this around {vb:raw $pagetext}

<vb:if condition="$show['member'] AND $bbuserinfo['posts'] >= 5">
{vb:raw $pagetext}
<vb:else />
<b>Sorry you must be logged in and have at least 5 posts to view this form.</b>
</vb:if>