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,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 629
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 458
  • Total: 458

Greetings: Birthday, Holiday, Time of Day

Started by JPDeni, October 22, 2006, 11:48:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

technodragon73

You're welcome...this is a much better version of a greeting than the one I had.  Originally I could greet users with the time of day, or on their birthday...but I love the fact that I can do the holidays now too!  Awesome job!

JPDeni

Thank you -- and thanks to Aku, too. ;D

It was one of those things that was running around in my brain for several days and wouldn't leave me alone until I wrote it.

houston

I seem to be getting this error

Fatal error: Call to undefined function: greeting() in /home/eaglebay/public_html/newforum/Sources/Load.php(1613) : eval()'d code on line 306


No matter where I put this echo'
      <br />',greeting(),', <br />'.$context['user']['name'],'<br />';

technodragon73

did you upload the two files he had in the first post?  And did you add the require_once command as well?

houston

Quote from: TechnoDragon on October 24, 2006, 01:04:51 AM
did you upload the two files he had in the first post?  And did you add the require_once command as well?

All files uploaded. Must have missed the add the require_once command.

Thanks

houston

Quote from: TechnoDragon on October 24, 2006, 01:04:51 AM
did you add the require_once command as well?

That did not work either. I am try do place the greeting in the top area where it shows how log the member has been logged on for and the time of day. Using SMF1.1 rc2 and TP v0.96

JPDeni

Can you post the code you're trying to edit? I can show you were the "require_once" command goes.

houston

#17
Quote from: JPDeni on October 24, 2006, 02:08:45 AM
Can you post the code you're trying to edit? I can show you were the "require_once" command goes.

Here it is // If the user is logged in, display stuff like their name, new messages, etc.
if ($context['user']['is_logged'])
{
echo '
<a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a> <br />
<a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a><br />';

}


This is from the default index.template.php file

JPDeni

Let me just double-check. Are you sure you put the UserFunctions.php file in the Sources directory?

I'm still not sure where exactly you want the greeting to go. My guess is that you want it here, instead of $txt['hello_member_ndt']:

// display user name
echo '
  <table width="100%" cellpadding="0" cellspacing="0" border="0" >
  <tr>';
  if($context['user']['is_logged'])
    echo '
      <td class="titlebg2" height="32">
          <span style="font-size: 130%;"> ', $txt['hello_member_ndt'], ' <b>', $context['user']['name'] , '</b></span>
       </td>';


So, this is what you would use:

// display user name
require_once('UserFunctions.php');
echo '
  <table width="100%" cellpadding="0" cellspacing="0" border="0" >
  <tr>';
  if($context['user']['is_logged'])
    echo '
      <td class="titlebg2" height="32">
          <span style="font-size: 130%;"> ', greeting(), ' <b>', $context['user']['name'] , '</b></span>
       </td>';


houston

Quote from: JPDeni on October 24, 2006, 03:23:00 AM
Let me just double-check. Are you sure you put the UserFunctions.php file in the Sources directory?

I'm still not sure where exactly you want the greeting to go. My guess is that you want it here, instead of $txt['hello_member_ndt']:

// display user name
echo '
  <table width="100%" cellpadding="0" cellspacing="0" border="0" >
  <tr>';
  if($context['user']['is_logged'])
    echo '
      <td class="titlebg2" height="32">
          <span style="font-size: 130%;"> ', $txt['hello_member_ndt'], ' <b>', $context['user']['name'] , '</b></span>
       </td>';


So, this is what you would use:

// display user name
require_once('UserFunctions.php');
echo '
  <table width="100%" cellpadding="0" cellspacing="0" border="0" >
  <tr>';
  if($context['user']['is_logged'])
    echo '
      <td class="titlebg2" height="32">
          <span style="font-size: 130%;"> ', greeting(), ' <b>', $context['user']['name'] , '</b></span>
       </td>';



I will check again. Just about to read to my son so I will have to get back to this later.

Cheers

This website is proudly hosted on Crocweb Cloud Website Hosting.