/** * Removes a profile entry, associated picture, and redirects to main listing * * @return void */ public function removeTask() { // Check for request forgeries Request::checkToken(); // Incoming $ids = Request::getVar('ids', array()); // Do we have any IDs? if (!empty($ids)) { // Loop through each ID and delete the necessary items foreach ($ids as $id) { $id = intval($id); // Delete any associated pictures $path = PATH_APP . DS . trim($this->config->get('webpath', '/site/members'), DS) . DS . \Hubzero\Utility\String::pad($id); if (!file_exists($path . DS . $file) or !$file) { $this->setError(Lang::txt('COM_MEMBERS_FILE_NOT_FOUND')); } else { unlink($path . DS . $file); } // Remove any contribution associations $assoc = new \Components\Members\Tables\Association($this->database); $assoc->authorid = $id; $assoc->deleteAssociations(); // Remove the profile $profile = new Profile(); $profile->load($id); $profile->delete(); } } // Output messsage and redirect App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_MEMBERS_REMOVED')); }