TinyPortal
Development => Support => Topic started by: elund on August 25, 2007, 07:59:22 PM
I am trying to implement the same conditional welcome as featured on tinyportal.co.uk:
Welcome elund!
Do you want to:
* Read unread topics since last visit?
* Read new replies to your posts?
* Check out your personal messages? (0/0)
* Visit the download section?
Is this feature implemented with a conditional block?
When adding a conditional block to the frontpage it is not shown when selecting "Featured article and front page blocks" for what to show on front page. Only when selecting "Front page blocks" the conditional block is shown. Is this a bug in TinyPortal or what do I miss?
Best regards, Elund
What you are seeing on the frontpage is an article with php code.
The code you're looking for is this:
if($context['user']['is_logged'])
{
echo '<h1>Welcome '.$context['user']['name'].'!</h1>
<p>Do you want to:
<ul>
<li><a href="index.php?action=unread">Read unread topics since last visit?</a></li>
<li><a href="index.php?action=unreadreplies">Read new replies to your posts?</a></li>
<li><a href="index.php?action=pm">Check out your personal messages? ('.$context['user']['messages'].'/', $context['user']['unread_messages']>0 ? '<b>'.$context['user']['unread_messages'].'</b>' : $context['user']['unread_messages'] , ')</a></li>
<li><a href="index.php?action=tpmod;dl">Visit the download section?</a></li>
</ul>
</p>';
}
else
{
echo '<h1>Welcome!</h1>
<p>Do you want to:
<ul>
<li><a href="index.php?action=login">Login?</a></li>
<li><a href="index.php?action=unread">Register at our site?</a></li>
<li><a href="index.php?action=tpmod;dl">Visit the download section?</a>(NB! TinyPortal downloads require that you register and login first. SMF themes do not.)</li>
</ul>
</p>';
}
great code! but i found a very little mistype:
<li><a href="index.php?action=unread">Register at our site?</a></li>
should be register ;)
Indeed! Thank you, as I'm always logged in I would have never noticed not looking to sharply at the code. :) Will correct that right now.
Heh..indeed a typo there. :)