Пример #1
0
 /**
  * Remove all user blog entries for the given user ID
  *
  * Method is called after user data is deleted from the database
  *
  * @param   array    $user     Holds the user data
  * @param   boolean  $success  True if user was succesfully stored in the database
  * @param   string   $msg      Message
  * @return  boolean
  */
 public function onMemberAfterDelete($user, $success, $msg)
 {
     if (!$success) {
         return false;
     }
     $userId = \Hubzero\Utility\Arr::getValue($user, 'id', 0, 'int');
     if ($userId) {
         try {
             include_once PATH_CORE . DS . 'components' . DS . 'com_collections' . DS . 'models' . DS . 'archive.php';
             $db = App::get('db');
             $model = new \Components\Collections\Tables\Collection($db);
             $entries = $model->find('list', array('created_by' => $userId));
             foreach ($entries as $entry) {
                 $entry = new \Components\Collections\Models\Collection($entry);
                 if (!$entry->delete()) {
                     throw new Exception($entry->getError());
                 }
             }
         } catch (Exception $e) {
             return false;
         }
     }
     return true;
 }