Jump to content

How can i delete customer messages?

Recommended Posts

  • 4 months later...

Same problem for me.
I made some edit in the code:
adminXYZ/tabs/AdminOrders.php added a new elseif after the markAsReaded line 286

elseif (isset($_GET['messageReaded']))
           Message::markAsReaded(intval($_GET['messageReaded']), intval($cookie->id_employee));
//new code for deleting messages
       elseif (isset($_GET['deleteMessage']))
           Message::deleteMessage(intval($_GET['deleteMessage']), intval($cookie->id_employee));
//end new code for deleting messages

adminXYZ/tabs/AdminOrders.php added this code around line 800:

echo (intval($message['private']) == 1 ? ''.$this->l('Private:').'' : '');
               //the next line add a nice X icon for deleting message
               echo ' l('Delete message').'" href="'.$_SERVER['REQUEST_URI'].'&deleteMessage;='.intval($message['id_message']).'">';
               echo '

The most important: in classes/Message.php added a new function

static public function deleteMessage($id_message)
        if (!Validate::isUnsignedId($id_message))

       $result = Db::getInstance()->Execute('
       DELETE FROM '._DB_PREFIX_.'message WHERE id_message ='.intval($id_message).';
       $result2 = Db::getInstance()->Execute('
       SELECT * FROM '._DB_PREFIX_.'message_readed WHERE id_message ='.intval($id_message).';
       if ($result2!=''){//there are some read messages, let's delete those records too 
           $result3 = Db::getInstance()->Execute('
       DELETE FROM '._DB_PREFIX_.'message_readed WHERE id_message ='.intval($id_message).';
       return $result;

I hope this can help

Link to comment
Share on other sites

  • 5 months later...
  • 6 months later...
  • 11 months later...
  • 2 months later...
  • 2 months later...
  • Create New...