TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,965
  • Latest: boruko
Stats
  • Total Posts: 195,980
  • Total Topics: 21,320
  • Online today: 281
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 294
  • Total: 294

Conditional welcome on frontpage

Started by elund, August 25, 2007, 07:59:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

elund

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

IchBin

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>';
}

haderaschta

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 ;)

IchBin

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.

bloc


This website is proudly hosted on Crocweb Cloud Website Hosting.