Author Topic: How to block chat history of other operators?  (Read 7807 times)

0 Members and 1 Guest are viewing this topic.

tianesa

  • Jr. Member
  • **
  • Posts: 3
How to block chat history of other operators?
« on: July 03, 2012, 08:31:56 PM »
I would not want operators to have access to chat the other sector operators. Have this option when configuring. But if the user clicks the Search History Conversations, open all the conversations of all operators.

mbouwer

  • Jr. Member
  • **
  • Posts: 1
Re: How to block chat history of other operators?
« Reply #1 on: September 03, 2012, 02:58:37 PM »
I solved this problem by manually restricting the results that the search-query in history.php returns. To only return the results for the groups that the currently logged-in operator belongs to, add the 2 lines marked in bold in the code-extract below to operator/history.php (around line 48):

$x = $operator['operatorid']; // Load operatorid of currently logged-in operator into variable to use in extra added condition in query below.

   $escapedQuery = mysql_real_escape_string($query, $link);
   select_with_pagintation("DISTINCT unix_timestamp(${mysqlprefix}chatthread.dtmcreated) as created, " .
                     "unix_timestamp(${mysqlprefix}chatthread.dtmmodified) as modified, ${mysqlprefix}chatthread.threadid, " .
                     "${mysqlprefix}chatthread.remote, ${mysqlprefix}chatthread.agentName, ${mysqlprefix}chatthread.userName, groupid, " .
                     "messageCount as size",
                     "${mysqlprefix}chatthread, ${mysqlprefix}chatmessage",
                     array(
                          "groupid IN (SELECT ${mysqlprefix}chatgroupoperator.groupid FROM ${mysqlprefix}chatgroupoperator where operatorid = $x)",
                                                             "${mysqlprefix}chatmessage.threadid = ${mysqlprefix}chatthread.threadid",
                          "((${mysqlprefix}chatthread.userName LIKE '%%$escapedQuery%%') or (${mysqlprefix}chatmessage.tmessage LIKE '%%$escapedQuery%%'))"
                     ),
                     "order by created DESC",
                     "DISTINCT ${mysqlprefix}chatthread.dtmcreated", $link);

   mysql_close($link);


It works perfectly fine in my install, hope this helps you...

Cheers,
Marco
lead-developer
www.thesavvyfew.com

thera

  • Jr. Member
  • **
  • Posts: 1
Re: How to block chat history of other operators?
« Reply #2 on: December 02, 2013, 01:57:17 PM »
Marco congratulations modification, it surely is essential to Mibew.

If I want that each user can only see their chats, and the administrator can view all chats as I do?

Thank you.