Hiding text / images to logged in users

So I have certain lines of text and images in my site that I only want to have visible to unlogged customers.

When a customer logs in I want these lines of text and images to be hidden.

My site is a B2B site and so I need to hide info that is not relevant to my customers but is relevant to end users.



I use the {if $auth.user_id} to hide text and images to non logged users.



So how would one do this?



Any help on this would be greatly appreciated.

Thanks

You can declare new variables or use the existing. Use “not” as either neq or <> or ! or != or null:

[quote][color=#0000cd]{if $auth.user_id <> null}[/color] [color=#ff0000]or[/color][color=#0000cd] {if $auth.user_id}[/color]

Logged in.

[color=#0000cd]{else} [/color][color=#ff0000]or[/color][color=#0000cd] {elseif [color=#0000cd]$auth.user_id eq null[/color]}[/color]

Logged out.

[color=#0000cd]{/if}[/color][/quote]



I haven’t tried these examples, but it’s fairly simple Smarty. Just place a [color=#0000cd]{debug} [/color]on a page you wish to view the available variables that you can use in your statements. :)



Here’s a bookmark I use all the time for reference, however i’ve since made my own table in Word and printed it out: http://www.smarty.ne…function.if.tpl

Thanks very much for that advice. Had to read it a couple times as well as the link you gave before I realized you had to declare it in that order!, but got it working as required in the end.

Cheers! :grin:

Here is what I ended up with.




[quote]

<br />
{if $auth.user_id}<br />
<ul class="account-info"><br />
<li>{$lang.welcome}</li><br />
</ul><br />
{else}<br />
<ul class="account-info"><br />
<li><a href="http://www.mysite.com/index.php?dispatch=pages.view&page_id=18"> {$lang.new_dealer}</a></li><br />
  </ul><br />
  {/if}<br />

```<br />
[/quote]