Chat Room
[resolved] add time (6 posts)

  1. majjhol
    Posted 2 years ago #

    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


  2. Eric Andrew Lewis
    Plugin Author

    Posted 2 years ago #

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

  3. kaity123
    Posted 2 years ago #

    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!

  4. Eric Andrew Lewis
    Plugin Author

    Posted 2 years ago #

    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!

  5. kaity123
    Posted 2 years ago #

    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 WordPress.org! (Deserves 10 stars!!!)

  6. Eric Andrew Lewis
    Plugin Author

    Posted 2 years ago #

    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>',

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Chat Room
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.