WordPress.org

Ready to get started?Download WordPress

Forums

Chat Room
[resolved] add time (6 posts)

  1. majjhol
    Member
    Posted 1 year 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

    http://wordpress.org/extend/plugins/chat-room/

  2. Eric Lewis
    Member
    Plugin Author

    Posted 1 year ago #

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

  3. kaity123
    Member
    Posted 1 year 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 Lewis
    Member
    Plugin Author

    Posted 1 year 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
    Member
    Posted 1 year 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 Lewis
    Member
    Plugin Author

    Posted 1 year 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

About this Topic

Tags

No tags yet.