/**
  * function used to delete all the forum and replies given by a user.
  * if group_id is given then the forums of that particular group will be deleted
  * otherwise all forums related to that in all the groups will be deleted
  */
 public function delete_user_forums()
 {
     Logger::log("Enter: function MessageBoard::delete_user_forums");
     //$forums = MessageBoard::get_forums( $params );
     // delete replies posted by user
     Dal::query("DELETE FROM {boardmessages} WHERE user_id = {$this->user_id} AND parent_type = '" . PARENT_TYPE_MESSAGE . "'");
     //find threads
     //now we have only threads left
     $sql = "SELECT  boardmessage_id FROM {boardmessages} WHERE user_id = {$this->user_id} ";
     $res = Dal::query($sql);
     if ($res->numRows() > 0) {
         while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
             $pid = $row->boardmessage_id;
             MessageBoard::delete_replies($pid);
             //delete replies
             MessageBoard::delete($pid);
             //delete the board message itself
         }
     }
     Logger::log("Exit: function MessageBoard::delete_user_forums");
 }