/** * Delete spam and optionally delete the users. * @param type $LogIDs */ public function deleteSpam($LogIDs) { $this->permission(array('Garden.Moderation.Manage', 'Moderation.Spam.Manage'), false); if (!$this->Request->isPostBack()) { throw permissionException('Javascript'); } $LogIDs = explode(',', $LogIDs); // Ban the appropriate users. $UserIDs = $this->Form->getFormValue('UserID', array()); if (!is_array($UserIDs)) { $UserIDs = array(); } if (!empty($UserIDs)) { // Grab the rest of the log entries. $OtherLogIDs = $this->LogModel->getWhere(array('Operation' => 'Spam', 'RecordUserID' => $UserIDs)); $OtherLogIDs = array_column($OtherLogIDs, 'LogID'); $LogIDs = array_merge($LogIDs, $OtherLogIDs); foreach ($UserIDs as $UserID) { Gdn::userModel()->ban($UserID, array('Reason' => 'Spam', 'DeleteContent' => true, 'Log' => true)); } } // Grab the logs. $this->LogModel->delete($LogIDs); $this->render('Blank', 'Utility'); }