Page 1 of 1

*** SOLVED *** Add variable to Time Greeting ?

Posted: Mon Dec 16, 2019 6:32 pm
by MGD4me
After a member logs in to the restricted area of the web site, I have set up the Time Greeting javascript function to show a "Good morning", or whatever greeting depending on the time of day. Since they have now logged on, I am able to retrieve their name from a database, and would like to know if it would be possible to include their name as part of the displayed Time Greeting, such as "Good morning " . $name . "!" ?? I realize the syntax here is incorrect, but where could I include $name along with the greeting?

Thanks.

Re: Add variable to Time Greeting ?

Posted: Mon Dec 16, 2019 7:05 pm
by Pablo
There is no standard solution for this. This will require a custom script.

Re: Add variable to Time Greeting ?

Posted: Mon Dec 16, 2019 7:16 pm
by MGD4me
I was afraid that might be the case, but I had to ask !! :wink:

Thanks

*** SOLVED *** Add variable to Time Greeting ?

Posted: Tue Dec 17, 2019 5:55 am
by MGD4me
Well, it wasn't as difficult as I thought !

I have the member's name stored in a variable "$name", pulled from the database once a member logs in, Then, in the each different Timed Greeting I can include their name by writing:

Good Morning <?php echo $name; ?>
Good Afternoon <?php echo $name; ?>
Good Evening <?php echo $name; ?>

Works like a charm! Just in case anyone else would like to do the same...