/** * Remove any associated resources when group is deleted * * @param object $group Group being deleted * @return string Log of items removed */ public function onGroupDelete($group) { // Get all the IDs for pages associated with this group $ids = $this->getPageIDs($group->get('cn')); // Import needed libraries include_once PATH_CORE . DS . 'components' . DS . 'com_wiki' . DS . 'tables' . DS . 'page.php'; // Instantiate a object $database = App::get('db'); // Start the log text $log = Lang::txt('PLG_GROUPS_WIKI_LOG') . ': '; if (count($ids) > 0) { // Loop through all the IDs for pages associated with this group foreach ($ids as $id) { $wp = new \Components\Wiki\Tables\Page($database); $wp->load($id->id); // Delete all items linked to this page //$wp->deleteBits($id->id); // Delete the wiki page last in case somehting goes wrong //$wp->delete($id->id); if ($wp->id) { $wp->state = 2; $wp->store(); } // Add the page ID to the log $log .= $id->id . ' ' . "\n"; } } else { $log .= Lang::txt('PLG_GROUPS_WIKI_NO_RESULTS_FOUND') . "\n"; } // Return the log return $log; }