Any way to recover/view chat logs that were cleared instead of archived?

Unfortunately someone accidentally cleared the chat instead of archiving the logs.

Typically it wouldn't be a big deal, but some issues came up during the chat (relates to potentially suspending a member from coming back to the chats), and we need the logs so others can see exactly what was said and how it was handled.

Is there any way to recover the messages? Are they stored somewhere in the backend that I can go back and get them? (IE. diving into FTP, file by file)?

The one benefit is that the chat was just last night, so if there's any chronological

As a side note - it NEEDS to be an option to 'remove' clear chat as a moderator option (so it doesn't even show up in the gear tab). Please make sure the Chat dev(s) get that memo.

This was always a potential issue before, so much that I actually go in and manually edit the Plugin code (never a good thing to do, as I have no idea what else I may be breaking). Unfortunately in the process of dealing with major bugs / migrating everything to a new website, I didn't want to risk editing core plugin files. Based on this, I will now have to, but I really need to get those logs!


  • Panos

    Hi Daniel ,

    After pressing Delete it actually deletes the chat history for the selected sessions and unfortunately there is no way of recovery. Chat discussions are being stored at prefix_wpmudev_chat_message and prefix_wpmudev_chat_log tables, if you don't see these chats there then I'm afraid that only hope of recovery is by asking your host if he has any previous backup.

    Regarding moderation access you can set who has privileges to access chat logs from admin menu > Chat > Settings Page under the Authentication tab at the bottom section where it says "Moderator Roles - Select which roles are moderators".

    Please contact your host asap and ask if he has a kept previous backup so he can provide it to you.

    Kind regards,

  • Daniel

    Hi Panos , thank-you for the quick reply about history. I'll look further (Just to confirm, we're talking about database tables right - there's no way to go through FTP to find a them)

    In terms of the access - it's not an issue of who has the privilege. Only our moderators have the privilege. The issue is that moderators can accidentally delete chats instead of archiving it, and I want to remove the option for moderators while keeping all of the other privileges available.

    I have removed in the past, by deleting a segment of code in the plugin - but I really don't doing that, as it's 100% a hit/miss activity.


  • Panos

    Hey Daniel,

    I didn't find any hooks for removing the Delete option. The easiest workaround would be to hide it with CSS and remove it with js if user is not allowed to delete, eg:

    add_action( 'admin_head', 'wpmudev_remove_unauthbulkdelete_from_chat' );
    function wpmudev_remove_unauthbulkdelete_from_chat(){
    	$screen = get_current_screen();
    	if( $screen->id == 'chat_page_chat_session_logs' && ! current_user_can( 'manage_options' ) ):
    	//$uid = get_current_user_id();
    	//$allowed_ids = array( 10,18,23 );
    	//if( $screen->id == 'chat_page_chat_session_logs' && ! in_array( $uid,  $allowed_ids ) ):
    		<style>#bulk-action-selector-top option[value=delete]{display: none;}</style>
    		<script type="text/javascript">jQuery(document).ready(function(){jQuery('#bulk-action-selector-top option[value=delete]').remove();});</script>

    In above example you can either check if user has admin privileges or if you prefer you can remove that check and use the user id specific check by uncommenting the lines that follow.

    Hope this helps :slight_smile:

    Kind regards,

  • Daniel

    Panos Sorry - I'm not the most familiar with programming (I edit plugins by trial and error, and have no idea what I'm doing)... Did you post the CSS version or the JSS or?

    I tried posting it as CSS, no change. CSS would work fine, and preferred over a code change (as any plug-in update may invalidate the code).

    To me it looks more like something that needs to go in the Theme Functions file, or the Plug-in Code file, no?

  • Daniel

    Panos I copied in your code exactly, to the functions.php file, and it crashes the website. Can you give another look over, see if anything's been left unclosed? The endif; part seems open, but when I tried to close it, it still crashed website.

    I am using it in a theme on a wordpress multisite, if that makes a difference.

    I also just tried removing the extra user id part (I don't need any exceptions, if no one is ever able to delete - I'm fine with that).

  • Panos

    Hi Daniel ,

    If you would like you can provide ftp access so I could try it out on your theme's functions.php file. You can send that privately through our contact form:

    Select "I have a different question?" for your topic - this and the subject line ensure that it gets assigned to me.

    Send in:Subject: "Attn: Panos Lyrakis"

    - Admin login:
    Admin username
    Admin password
    Login url

    - FTP credentials
    (and port if required)

    - link back to this thread for reference
    - any other relevant urls


  • Daniel

    Hi Panos thanks for being willing to look deeper, but I would need to set up secondary 'guest' FTP credentials, and then follow-up later.

    I did what I've done in the past, and removed the following code from chat plugin:

    $chat_action_menu .= '<li class="wpmudev-chat-action-menu-item-session-clear"><a href="#"
    				class="wpmudev-chat-action-session-clear">' .
    				                     __( 'Clear Chat', $this->translation_domain ) . '</a></li>';

    Menu item is gone, so accidents can't actually happen now. Thanks again for the help in this!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.