Joomla!: 3.4.8
Virtuemart: 3.0.13.6
Hello dear people,
I try my best to hide the .spacer-buy-area class for those who ain't logged in, i am aware there are multiple topics dedicated to this problem.
For a while i've been trying to get this fixed by following the given answers on these topics, though i can't get it to work is i would like.
What seemed to work for me is the block below:
<?php
if ($_SESSION['auth']['user_id'] < 1){ ?>
<style type="text/css" media="screen">.spacer-buy-area{display:none;}</style>
<?php}?>
It results in hiding the right content, but after logging on it doesn't show the spacer-buy-area, perhaps i am missing something.
Perhaps the right answer is on this forum but i just haven't found it yet, in this case my appologies for posting.
Kind regards,
-Ioncap
Use Joomla API:
<?php
$user = JFactory::getUser();
if ($user->guest) { ?>
<style type="text/css" media="screen">.spacer-buy-area{display:none;}</style>
<?php }
Note that using CSS isn't a good way to protect content. Instead you should wrap the whole buy area with an if statement.
Quote from: Ghost on March 09, 2016, 10:57:45 AM
Use Joomla API:
<?php
$user = JFactory::getUser();
if ($user->guest) { ?>
<style type="text/css" media="screen">.spacer-buy-area{display:none;}</style>
<?php }
Note that using CSS isn't a good way to protect content. Instead you should wrap the whole buy area with an if statement.
Thank you kindly Ghost, i implemented as you suggested would be the best.
It works like a charm again!
Sincerely yours,
-Ioncap