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

Recent

Welcome to TinyPortal. Please login or sign up.

March 28, 2024, 08:43:21 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,104
  • Total Topics: 21,212
  • Online today: 192
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 192
  • Total: 193
  • illori

Show hello message each day

Started by elpvn, May 18, 2006, 03:01:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

elpvn

<SCRIPT LANGUAGE="JavaScript">

<!--Begin

datetoday = new Date();
timenow=datetoday.getTime();
datetoday.setTime(timenow);
thehour = datetoday.getHours();
if (thehour > 18) display = "Evening";
else if (thehour >12) display = "Afternoon";
else display = "Morning";
var greeting = ("Good " + display + "!");
document.write(greeting);

//Ã,  End -->

</script>


Put it in a script/html blockÃ,   :)

akulion

I think this would be nice to have inside the tinyportal "user block" so that it says

"Good Morning"
Welcome Guest (or user - when logged in)

And change according to time of day :D

added to Block code snippet under "w" welcome message

Crip

I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



technodragon73

#3
To put it into the userbox:

In TPortalBlocks.template.php

Find:
// Tportal userbox
function TPortal_userbox()
{
          global $context, $settings, $options, $scripturl, $txt, $modSettings;

$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet2 = '<img src="'.$settings['images_url'].'/TPdivider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet3 = '<img src="'.$settings['images_url'].'/TPdivider3.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet4 = '<img src="'.$settings['images_url'].'/tpgoto.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet5 = '<img src="'.$settings['images_url'].'/tpmodule2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

        echo'<table width="99%" cellpadding="0" cellspacing="5" border="0"><tr>';
        echo '<td width="100%" valign="top" class="smalltext" style="font-family: verdana, arial, sans-serif;">';

        if (!empty($context['user']['avatar']) && isset($context['TPortal']['userbox']['avatar']))
                echo $context['user']['avatar']['image'] . '<br />';

        // If the user is logged in, display stuff like their name, new messages, etc.
        if ($context['user']['is_logged'])
        {

                echo '<span class="normaltext">
                                                        ', $txt['hello_member'], ' <b>', $context['user']['name'], '</b></span>';

                // Only tell them about their messages if they can read their messages!
                if ($context['allow_pm']){
                        echo '<br />'.$bullet.'<a href="', $scripturl, '?action=pm">' .$txt['tp-pm'].' ', $context['user']['messages'], '</a>';
                   if($context['user']['unread_messages']>0)
                        echo '<br />'.$bullet.'<a style="font-weight: bold; " href="', $scripturl, '?action=pm">' .$txt['tp-pm2'].' ',$context['user']['unread_messages'] , '</a>';

                }
                // Are there any members waiting for approval?
                if (!empty($context['unapproved_members']))
                        echo '<br />'.$bullet.'<a href="', $scripturl, '?action=regcenter">'.$txt['tp_unapproved_members'].'<b> '. $context['unapproved_members']  . '</b></a>';

                if(isset($context['TPortal']['userbox']['unread'])){
                      echo '<br />'.$bullet.'<a href="', $scripturl, '?action=unread">' .$txt['tp-unread'].'</a>
                               <br />'.$bullet.'<a href="', $scripturl, '?action=unreadreplies">'.$txt['tp-replies'].'</a>
                               <br />'.$bullet.'<a href="', $scripturl, '?action=profile;u='.$context['user']['id'].';sa=showPosts">'.$txt['tp-showownposts'].'</a>';
               }

                // Is the forum in maintenance mode?
                if ($context['in_maintenance'] && $context['user']['is_admin'])
                        echo '<br /><b>' .$bullet.$txt['tp_maintenace']. '</b>';
                // Show the total time logged in?
                if (!empty($context['user']['total_time_logged_in']) && isset($context['TPortal']['userbox']['logged']))
                {
                        echo '<br />'.$bullet.$txt['tp-loggedintime'] . ' ';

                         echo '<br />'.$context['user']['total_time_logged_in']['days'] . 'd ';
                         echo $context['user']['total_time_logged_in']['hours'] . 'h ';
                         echo $context['user']['total_time_logged_in']['minutes'] .'m';
                }
               if(isset($context['TPortal']['userbox']['time'])){
                     echo '<br />'.$bullet. $context['current_time'];
               }

// module links - do not show if none
if($context['TPortal']['show_download']=='1')
{
echo '<hr /><p style="margin: 4px 0 5px 0;"><img src="'.$settings['images_url'].'/tpmodule.gif" style="margin: 0;" align="absbottom" alt="" />
      <b>'.$txt['tp-admin4'].'</b></p>';
if($context['TPortal']['show_download']=='1')
echo $bullet5.' <a href="'.$scripturl.'?action=tpmod;dl=0">'.$txt['tp-dldownloads'].'</a><br />';
}
// admin parts etc.
             if(!isset($context['TPortal']['can_submit_article']))
                  $context['TPortal']['can_submit_article']=0;
// do not show if none is availalable
if($context['TPortal']['can_submit_article']==1 || allowedTo(array('tp_dlupload','tp_dlmanager','tp_settings','tp_articles','tp_blocks')))
{
echo '<hr /><p style="margin: 4px 0 5px 0;"><img src="'.$settings['images_url'].'/tpoptions.gif" style="margin: 0;" align="absbottom" alt="" />
      <b>'.$txt['tp-tools'].'</b></p>';
              // can we submit an article?
              if($context['TPortal']['can_submit_article']==1 && !allowedTo('tp_articles'))
                       echo $bullet4.'<a href="', $scripturl, '?action=tpmod;sa=submitarticle">' . $txt['tp-submitarticle']. '</a><br />';

// upload a file?
              if(allowedTo('tp_dlupload') || allowedTo('tp_dlmanager'))
                       echo $bullet4.'<a href="', $scripturl, '?action=tpmod;dl=upload">' . $txt['permissionname_tp_dlupload']. '</a><br />';

// tpadmin checks
if (allowedTo('tp_settings'))
echo $bullet4.'<a href="' . $scripturl . '?action=tpadmin;sa=settings">' . $txt['permissionname_tp_settings'] . '</a><br />';
if (allowedTo('tp_blocks'))
echo $bullet4.'<a href="' . $scripturl . '?action=tpadmin;sa=blocks">' . $txt['permissionname_tp_blocks'] . '</a><br />';
if (allowedTo('tp_articles'))
{
echo $bullet4.'<a href="' . $scripturl . '?action=tpadmin;sa=articles">' . $txt['permissionname_tp_articles'] . '</a><br />';
// any submissions?
if($context['TPortal']['submitcheck']['articles']>0)
echo $bullet4.$bullet3.'<a href="' . $scripturl . '?action=tpadmin;sa=submission"><b>' . $context['TPortal']['submitcheck']['articles'] . ' ' .$txt['tp-articlessubmitted'] . '</b></a><br />';
}
if (allowedTo('tp_dlmanager'))
{
echo $bullet4.'<a href="' . $scripturl . '?action=tpmod;dl=admin">' . $txt['permissionname_tp_dlmanager'] . '</a>';
// any submissions?
if($context['TPortal']['submitcheck']['uploads']>0)
echo '<br />'.$bullet4.$bullet3.'<a href="' . $scripturl . '?action=tpmod;dl=adminsubmission"><b>' . $context['TPortal']['submitcheck']['uploads'] . ' ' .$txt['tp-dluploaded'] . '</b></a><br />';
}
}

               echo '</div>';
        }
        // Otherwise they're a guest - so politely ask them to register or login.
        else
        {
                echo '
                                                        ', $txt['welcome_guest'], '<br />
                                                        ', $context['current_time'], '<br />

                                                        <form action="', $scripturl, '?action=login2" method="post" >
                                                                <input type="text" name="user" size="10" /> <input type="password" name="passwrd" size="10" />
                                                                <select name="cookielength">
                                                                        <option value="60">', $txt['smf53'], '</option>
                                                                        <option value="1440">', $txt['smf47'], '</option>
                                                                        <option value="10080">', $txt['smf48'], '</option>
                                                                        <option value="302400">', $txt['smf49'], '</option>
                                                                        <option value="-1" selected="selected">', $txt['smf50'], '</option>
                                                                </select>
                                                                <input type="submit" value="', $txt[34], '" /><br />
                                                                ', $txt['smf52'], '
                                                        </form>';
// module links
echo '<hr /><p style="margin: 4px 0 5px 0;"><img src="'.$settings['images_url'].'/tpmodule.gif" style="margin: 0;" align="absbottom" alt="" />
      <b>'.$txt['tp-admin4'].'</b></p>';
if($context['TPortal']['show_download']=='1')
echo $bullet2.'<a href="'.$scripturl.'?action=tpmod;dl=0">'.$txt['tp-dldownloads'].'</a><br />';
        }
echo '<br /></td></tr></table>';

}


and replace with:
// Tportal userbox
function TPortal_userbox()
{
          global $context, $settings, $options, $scripturl, $txt, $modSettings;

$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet2 = '<img src="'.$settings['images_url'].'/TPdivider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet3 = '<img src="'.$settings['images_url'].'/TPdivider3.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet4 = '<img src="'.$settings['images_url'].'/tpgoto.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet5 = '<img src="'.$settings['images_url'].'/tpmodule2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

        echo'<table width="99%" cellpadding="0" cellspacing="5" border="0"><tr>';
        echo '<td width="100%" valign="top" class="smalltext" style="font-family: verdana, arial, sans-serif;">';

        if (!empty($context['user']['avatar']) && isset($context['TPortal']['userbox']['avatar']))
                echo $context['user']['avatar']['image'] . '<br />';

        // If the user is logged in, display stuff like their name, new messages, etc.
        if ($context['user']['is_logged'])
        {

                echo '<span class="normaltext">
<SCRIPT LANGUAGE="JavaScript">

<!--Begin

datetoday = new Date();
timenow=datetoday.getTime();
datetoday.setTime(timenow);
thehour = datetoday.getHours();
if (thehour > 18) display = "Evening";
else if (thehour >12) display = "Afternoon";
else display = "Morning";
var greeting = ("Good " + display + "!");
document.write(greeting);

//  End -->

</script> <br> <b>', $context['user']['name'], '</b></span>';

                // Only tell them about their messages if they can read their messages!
                if ($context['allow_pm']){
                        echo '<br />'.$bullet.'<a href="', $scripturl, '?action=pm">' .$txt['tp-pm'].' ', $context['user']['messages'], '</a>';
                   if($context['user']['unread_messages']>0)
                        echo '<br />'.$bullet.'<a style="font-weight: bold; " href="', $scripturl, '?action=pm">' .$txt['tp-pm2'].' ',$context['user']['unread_messages'] , '</a>';

                }
                // Are there any members waiting for approval?
                if (!empty($context['unapproved_members']))
                        echo '<br />'.$bullet.'<a href="', $scripturl, '?action=regcenter">'.$txt['tp_unapproved_members'].'<b> '. $context['unapproved_members']  . '</b></a>';

                if(isset($context['TPortal']['userbox']['unread'])){
                      echo '<br />'.$bullet.'<a href="', $scripturl, '?action=unread">' .$txt['tp-unread'].'</a>
                               <br />'.$bullet.'<a href="', $scripturl, '?action=unreadreplies">'.$txt['tp-replies'].'</a>
                               <br />'.$bullet.'<a href="', $scripturl, '?action=profile;u='.$context['user']['id'].';sa=showPosts">'.$txt['tp-showownposts'].'</a>';
               }

                // Is the forum in maintenance mode?
                if ($context['in_maintenance'] && $context['user']['is_admin'])
                        echo '<br /><b>' .$bullet.$txt['tp_maintenace']. '</b>';
                // Show the total time logged in?
                if (!empty($context['user']['total_time_logged_in']) && isset($context['TPortal']['userbox']['logged']))
                {
                        echo '<br />'.$bullet.$txt['tp-loggedintime'] . ' ';

                         echo '<br />'.$context['user']['total_time_logged_in']['days'] . 'd ';
                         echo $context['user']['total_time_logged_in']['hours'] . 'h ';
                         echo $context['user']['total_time_logged_in']['minutes'] .'m';
                }
               if(isset($context['TPortal']['userbox']['time'])){
                     echo '<br />'.$bullet. $context['current_time'];
               }

// module links - do not show if none
if($context['TPortal']['show_download']=='1')
{
echo '<hr /><p style="margin: 4px 0 5px 0;"><img src="'.$settings['images_url'].'/tpmodule.gif" style="margin: 0;" align="absbottom" alt="" />
      <b>'.$txt['tp-admin4'].'</b></p>';
if($context['TPortal']['show_download']=='1')
echo $bullet5.' <a href="'.$scripturl.'?action=tpmod;dl=0">'.$txt['tp-dldownloads'].'</a><br />';
}
// admin parts etc.
             if(!isset($context['TPortal']['can_submit_article']))
                  $context['TPortal']['can_submit_article']=0;
// do not show if none is availalable
if($context['TPortal']['can_submit_article']==1 || allowedTo(array('tp_dlupload','tp_dlmanager','tp_settings','tp_articles','tp_blocks')))
{
echo '<hr /><p style="margin: 4px 0 5px 0;"><img src="'.$settings['images_url'].'/tpoptions.gif" style="margin: 0;" align="absbottom" alt="" />
      <b>'.$txt['tp-tools'].'</b></p>';
              // can we submit an article?
              if($context['TPortal']['can_submit_article']==1 && !allowedTo('tp_articles'))
                       echo $bullet4.'<a href="', $scripturl, '?action=tpmod;sa=submitarticle">' . $txt['tp-submitarticle']. '</a><br />';

// upload a file?
              if(allowedTo('tp_dlupload') || allowedTo('tp_dlmanager'))
                       echo $bullet4.'<a href="', $scripturl, '?action=tpmod;dl=upload">' . $txt['permissionname_tp_dlupload']. '</a><br />';

// tpadmin checks
if (allowedTo('tp_settings'))
echo $bullet4.'<a href="' . $scripturl . '?action=tpadmin;sa=settings">' . $txt['permissionname_tp_settings'] . '</a><br />';
if (allowedTo('tp_blocks'))
echo $bullet4.'<a href="' . $scripturl . '?action=tpadmin;sa=blocks">' . $txt['permissionname_tp_blocks'] . '</a><br />';
if (allowedTo('tp_articles'))
{
echo $bullet4.'<a href="' . $scripturl . '?action=tpadmin;sa=articles">' . $txt['permissionname_tp_articles'] . '</a><br />';
// any submissions?
if($context['TPortal']['submitcheck']['articles']>0)
echo $bullet4.$bullet3.'<a href="' . $scripturl . '?action=tpadmin;sa=submission"><b>' . $context['TPortal']['submitcheck']['articles'] . ' ' .$txt['tp-articlessubmitted'] . '</b></a><br />';
}
if (allowedTo('tp_dlmanager'))
{
echo $bullet4.'<a href="' . $scripturl . '?action=tpmod;dl=admin">' . $txt['permissionname_tp_dlmanager'] . '</a>';
// any submissions?
if($context['TPortal']['submitcheck']['uploads']>0)
echo '<br />'.$bullet4.$bullet3.'<a href="' . $scripturl . '?action=tpmod;dl=adminsubmission"><b>' . $context['TPortal']['submitcheck']['uploads'] . ' ' .$txt['tp-dluploaded'] . '</b></a><br />';
}
}

               echo '</div>';
        }
        // Otherwise they're a guest - so politely ask them to register or login.
        else
        {
                echo '
                                                        ', $txt['welcome_guest'], '<br />
                                                        ', $context['current_time'], '<br />

                                                        <form action="', $scripturl, '?action=login2" method="post" >
                                                                <input type="text" name="user" size="10" /> <input type="password" name="passwrd" size="10" />
                                                                <select name="cookielength">
                                                                        <option value="60">', $txt['smf53'], '</option>
                                                                        <option value="1440">', $txt['smf47'], '</option>
                                                                        <option value="10080">', $txt['smf48'], '</option>
                                                                        <option value="302400">', $txt['smf49'], '</option>
                                                                        <option value="-1" selected="selected">', $txt['smf50'], '</option>
                                                                </select>
                                                                <input type="submit" value="', $txt[34], '" /><br />
                                                                ', $txt['smf52'], '
                                                        </form>';
// module links
echo '<hr /><p style="margin: 4px 0 5px 0;"><img src="'.$settings['images_url'].'/tpmodule.gif" style="margin: 0;" align="absbottom" alt="" />
      <b>'.$txt['tp-admin4'].'</b></p>';
if($context['TPortal']['show_download']=='1')
echo $bullet2.'<a href="'.$scripturl.'?action=tpmod;dl=0">'.$txt['tp-dldownloads'].'</a><br />';
        }
echo '<br /></td></tr></table>';

}



This will add the greeting to the user box for TP (extra bonus! this also includes the birthday greeting mod so if it is a members birthday it will greet them with a special message!) Edit: was part of a modification that included edits to other files as well so i removed it from the above code

akulion


technodragon73


feral

good work Techno, i've been trying to get around to that for my site for a while but the time just wasn't there. thanks alot

RoarinRow


SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

technodragon73

I would say look at mine, but only registered members can see it (guests don't get to see much at my site anymore), but here are some screen shots:

RoarinRow

That's cool.  Does it get the time of day from their PC?   :up:

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0