TinyPortal

Development => Support => Topic started by: elund on August 25, 2007, 07:59:22 PM

Title: Conditional welcome on frontpage
Post 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
Title: Re: Conditional welcome on frontpage
Post by: IchBin on August 26, 2007, 02:15:37 AM
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>';
}
Title: Re: Conditional welcome on frontpage
Post by: haderaschta on August 26, 2007, 08:47:02 AM
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 ;)
Title: Re: Conditional welcome on frontpage
Post by: IchBin on August 26, 2007, 10:57:47 PM
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.
Title: Re: Conditional welcome on frontpage
Post by: bloc on August 26, 2007, 11:44:37 PM
Heh..indeed a typo there. :)