/**
  * Delete all private messages from a member
  *
  * @access	private
  * @return	void		[Outputs to screen]
  */
 private function _deleteMessages()
 {
     if (!$this->request['confirm']) {
         $countTopics = $this->DB->buildAndFetch(array('select' => 'count(*) as total', 'from' => 'message_topics', 'where' => 'mt_is_deleted=0 AND mt_starter_id=' . intval($this->request['member_id'])));
         $countReplies = $this->DB->buildAndFetch(array('select' => 'count(*) as total', 'from' => 'message_posts', 'where' => 'msg_is_first_post=0 AND msg_author_id=' . intval($this->request['member_id'])));
         $member = IPSMember::load($this->request['member_id']);
         //-----------------------------------------
         // Output
         //-----------------------------------------
         $this->registry->output->html .= $this->html->deleteMessagesWrapper($member, $countTopics, $countReplies);
     } else {
         //-----------------------------------------
         // Get messenger lib
         //-----------------------------------------
         require_once IPSLib::getAppDir('members') . '/sources/classes/messaging/messengerFunctions.php';
         $messengerLibrary = new messengerFunctions($this->registry);
         if ($this->request['topics']) {
             //-----------------------------------------
             // Get topic ids
             //-----------------------------------------
             $messages = array();
             $this->DB->build(array('select' => 'mt_id', 'from' => 'message_topics', 'where' => 'mt_is_deleted=0 AND mt_starter_id=' . intval($this->request['member_id'])));
             $this->DB->execute();
             while ($r = $this->DB->fetch()) {
                 $messages[] = $r['mt_id'];
             }
             //-----------------------------------------
             // Delete topics
             //-----------------------------------------
             if (count($messages)) {
                 $messengerLibrary->deleteTopics($this->request['member_id'], $messages, null, true);
             }
         }
         if ($this->request['replies']) {
             //-----------------------------------------
             // Get reply ids
             //-----------------------------------------
             $messages = array();
             $this->DB->build(array('select' => 'msg_id', 'from' => 'message_posts', 'where' => 'msg_is_first_post=0 AND msg_author_id=' . intval($this->request['member_id'])));
             $this->DB->execute();
             while ($r = $this->DB->fetch()) {
                 $messages[] = $r['msg_id'];
             }
             //-----------------------------------------
             // Delete topics
             //-----------------------------------------
             if (count($messages)) {
                 $messengerLibrary->deleteMessages($messages, $this->request['member_id']);
             }
         }
         $this->registry->output->redirect($this->settings['base_url'] . "module=members&section=members&do=viewmember&member_id=" . $this->request['member_id'], $this->lang->words['deleted_pms']);
     }
 }