Support » Plugin: Chat Room » add time

  • Resolved majjhol


    I did a simple step to add time , in the chat-room.php file ..

    '<div class="chat-message-' . $new_message_id . '"><span class=time>(' . date("g:ia") . ')</span> <strong style="color: ' . $user_text_color . ';">' . $user->nickname . '</strong>: ' . $content . '</div>',

    thank you for the great plugin

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Eric Andrew Lewis


    Thanks for sharing majjhol! We’ll probably include something like this in a future release.



    Hi majjhol,

    I tried adding code to the bottom of chat-room.php but when I uploaded, I got a “blank” page when adding a new chat.

    Obviously, I’m not a coder!

    Sure this is simple, but could you tell me what line/where to add the code?

    I need a “timer” that for example shows how long I’ve been chatting with someone.

    Thanks to both Eric Andrew Lewis and Majjhol for taking the time and such a great plugin!

    Plugin Author Eric Andrew Lewis


    Hi kaity123,

    you would be replacing lines 164 and 177 with:

    'html' => '<div class="chat-message-' . $new_message_id . '"><strong style="color: ' . $user_text_color . ';">' . $user->user_login . '</strong>: ' . $content . '</div>',

    Be aware that you’re modifying a core file in the plugin. Good luck!

    Thank you it worked! I replaced lines 164 and 177 with the code that majjhol provided above, and got the time to show next to my “nickname”.

    The only thing is that the clock is 5 hours off. Example: I’m in Eastern Standard time and its’ 5:34 PM, but the clock shows 10:34.

    Its a minor thing and if you have any suggestions on how to fix, let me know.

    Otherwise, I can live with it the way it is!

    Thank you so much Eric for this excellent plugin. I gave it 5 stars in! (Deserves 10 stars!!!)

    Plugin Author Eric Andrew Lewis


    Hey kaity123,

    glad you’re having success and liking the plugin!

    The issue here is that the time is output in the UTC timezone. Here’s a snippet below that should convert it to the WordPress timezone setting:

    '<div class="chat-message-' . $new_message_id . '"><span class=time>(' . date("g:ia", time() + ( get_option( 'gmt_offset' ) * 3600 ) ) . ')</span> <strong style="color: ' . $user_text_color . ';">' . $user->nickname . '</strong>: ' . $content . '</div>',
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘add time’ is closed to new replies.