Recent Topics

User Greeting

Started by on Feb 12, 2008 – Contents updated: Feb 12, 2008

1 Feb 12, 2008 09:59    

My b2evolution Version: Not Entered

Im not sure it if this is the right place. I was wondering if/how i can but user greeting. So in a side bar after user logs in it says.. Hello User, or maybe evening depending on day, Goodmorning ... etc.

Thanks for the help, mods if this is the wrong place feel free to move.

2 Feb 12, 2008 10:50

This can be easily done, however the way you do does depend on what version of B2 you have installed.

3 Feb 13, 2008 08:03

Damn, i apologize i didn't even realize that i hadn't put it.

It's the newest version. 2.4.0 "Venetian"

4 Feb 13, 2008 08:13

Ok, you can use the FreeHTML widget to add it where ever you wish in the sidebar or you can open open .index.main.php and simply hard code it into the sidebar with something like...

div class="bSideItem">
<p>Wecome to adda yadda yadda.......
hope you have a nice stay.
 etc etc</p>

5 Feb 13, 2008 10:37

I meant like Dynamic, so if i were to login as Admin it would say, "Hello Admin" or Joe logs in it says "Hello Joe" that type of thing.

6 Feb 13, 2008 10:41

You will have to leave that to some B2 guru to come up with the user_ID solution and related "if then else" mumbo jumbo.

Sorry I missed your point

7 Feb 13, 2008 10:45

if( is_logged_in() )
$greetings = array( 'god', 'morning', 'afternoon', 'evening' );
echo 'Good '.$greetings[ intval( date( 'h' ) / 6 ) ].' '.$current_User->get_preferred_name();

ish ;)


8 Feb 13, 2008 14:07

That's a clever bit of code, ¥åßßå. Thanks for sharing :)

9 Feb 13, 2008 18:28

I have my moments ;)


10 Feb 20, 2008 15:27

Just started using this and have a little question. Shouldn't it be using the 24 hour clock instead of 12? Cuz like with a 12 hour clock 2 in the afternoon would be 2 and would therefore intval to 0 after dividing by 6.

intval( date( 'H' ) / 6 ) instead of intval( date( 'h' ) / 6 ) ?

12 Feb 22, 2008 01:15

what is the get-login-name equivalent of $current_User->get_preferred_name()?

i'd like to use mine in if statements so i'll use something that my users can't change.

13 Mar 10, 2008 21:38


Hate to ask one of the dumbest questions about this, but WHAT file should this code be in? There seems to be an assumption that everyone knows which or what file to go into. If at all possible, I'd like to use the below.

if( is_logged_in() )
$greetings = array( 'god', 'morning', 'afternoon', 'evening' );
echo 'Good '.$greetings[ intval( date( 'h' ) / 6 ) ].' '.$current_User->get_preferred_name();

Also, I'd like to personalize the Log In page (with name/password). Where is this file? As well as the email confirmation for blogging.

Many thanks,

14 Mar 11, 2008 16:01

This bit of code would typically go in your skins/yourskin/index.main.php file, but it's really hard to say for sure because some skins use different file structures to build the page. Like for example look at the files in evopress and custom to see how different files can get used to make the pages.

The next question I have no idea. I never log out so I don't ever think about what the login page looks like.

15 Mar 11, 2008 16:07

mine is in htsrv/login.php. difficult to play with though. back it up or if you make a couple wrong keystrokes or your cat walks on your keyboard when you aren't looking, you won't be able to login (nor will your users!),

16 Mar 11, 2008 16:15

brandonh wrote:

mine is in htsrv/login.php. difficult to play with though. ...

Um... on a page that a logged in person doesn't need you have a greeting to a logged in person? I think I'm missing the point of that. Maybe I should go do my laundry and code something yah?

17 Mar 11, 2008 17:29

Also, I'd like to personalize the Log In page (with name/password). Where is this file? As well as the email confirmation for blogging.

Sorry. I should have quoted this in my message. I was pointing out where the login page was. htsrv/login.php

18 Mar 11, 2008 20:11

Thank you for pointing me in the right direction....

As for the cat thing ... :'( oh, boy! Thanks for the heads up.

:D Tosca

19 Mar 12, 2008 00:02

Ah that makes more sense :)

Form is loading...

Advanced CMS – This forum is powered by b2evolution CMS, a complete engine for your website.