Greeting messages based on time at day


 i added block (PHP) saying good morning , good night etc. to users based on the day, it include also the user name if exist and font awesome icon accordingly to the time


$Hour = date('G');
$memID = $_COOKIE['memberID'];
$nick = getNickName($memID);
if ( $Hour >= 0 && $Hour < 12 ) {
echo "Good Morning ".$nick." <i class='fa fa-sun-o fa-1x' aria-hidden='true'></i>";
} else if ( $Hour >= 12 && $Hour < 17 ) {
echo "Good Aftrenoon ".$nick." <i class='fa fa-cutlery fa-1x' aria-hidden='true'></i>";
} else if ( $Hour >= 17 && $Hour < 24 ) {
echo "Good Evening ".$nick." <i class='fa fa-moon-o fa-1x' aria-hidden='true'></i>

Always remember that the future comes one day at a time.
Quote · 18 Sep 2017

Nice. Does it know what timezone people are in?

Typo.... Good Afternoon.

Michel -
~~~~~~~~~~~~~~~~~~~~~~ - The Online Guide to Travel
Quote · 18 Sep 2017

you need to change it here date_default_timezone_set('Asia,Jerusalem');

Always remember that the future comes one day at a time.
Quote · 19 Sep 2017

It has been tested and confirmed working on 7.3.5

Quote · 8 May 2018

It works fine. Just change the timezone to your country and add the code to a PHP block.

I've PM'd you.

Quote · 15d ago

I'm not sure why it's not showing my replys lol I seem to be having an issue getting the font awesome to show. Any ideas on why?

Quote · 15d ago

Avoid using non web-safe fonts unless you know what you're doing. Always get things working without the bells and whistles and add them later. Do a search here for google fonts because there's been some discussion about getting them to work.

Quote · 14d ago

How would I use the users real name instead of their username?

Quote · 11d ago

It's a matter of taste. I find both of these offensive:

Good Morning CatFace99001166.

Good Morning Richard Tracy

I've used the First name field and changed it to read: Preferred Name. That way the member can add KittyCat (no offence) or Dick.

Thus the message would read: Good Morning KittyCat, or Good Morning Dick.

Hopefully a simple change from:

$nick = getNickName($memID);


$nick = getFirstName($memID);

should do it, or use

$nick =getFullName($memID);

(All untested)



Quote · 11d ago

Lol you said no offense to kittycat. That's funny :) glad to see you have a sense of humor lol

Quote · 11d ago

Ok so let's say I make a new "Name" field and say $nick =getName($memID); ?

Quote · 11d ago

ok so i just got home and i tried to change it to the values that you said, it throws a error 500 to the site. so that didnt work. any other suggestions?

Quote · 11d ago

I had a quick look at it. With my very limited knowledge and never having used "Get" before, I'm thinking NickName is indexed and other fields are not. I'm sorry but I don't have much time to take it any further at this stage, but it's on my to do list.

Quote · 10d ago

I've been trying too lmao I think I have to add something to the db. I'm still learning how dolphin blocks work. As soon as I figure it out it'll be easy as I know PHP hahah

Quote · 10d ago

to change the nickname from the "username" to the "full name" you would change that in the admin panel -> settings -> advanced settings -> Profiles part. 

Quote · 9d ago

Nope! Username is important.

This works. (See attachment)

Many thanks to Deano again. We miss him!

I'll work on the icons when I get time.

Welcome Message.rtf · 1.7K · 7 downloads
Quote · 9d ago

Have you given a look at what i wrote John?

I have tested this already and that code isnt needed. take a look at the included screenshots


With this first one you can see me changing the display name in the admin panel.


In this next one you will see the Full Name being shown.


And in this one you can see the username being shown


Now this is all by using the default code from the original post. there is no need to change the code as you have shown. (maybe they just added this feature and you havent updated it yet? idk but this is what is working for me.)


AlexT even states here 



The Purple Puppy

Quote · 8d ago

Sorry, but I read it before my morning coffee. I actually do that on all my sites, but I've been testing on a clean 7.3.5 install and I forgot to do it. I'm running Modzzz version of this on my main site so I was unable to test it there. 

Yep, that must do it as you've proven, but maybe you can still use my code if you want to use First Name, which I've called "Preferred Name" in Profile Edit . As I said before, some people may prefer to see Good Morning Dick, rather than Good Morning Richard Tracy. 

Geez That shoes my age doesn't it?

Quote · 8d ago