/** * @param null|int $id * @return bool */ public function delete( $id = null ) { global $_CB_database, $_PLUGINS; $_PLUGINS->trigger( 'gallery_onBeforeDeleteFolder', array( &$this ) ); if ( $this->get( 'id' ) ) { $query = 'SELECT *' . "\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin_gallery_items' ) . "\n WHERE " . $_CB_database->NameQuote( 'folder' ) . " = " . (int) $this->get( 'id' ); $_CB_database->setQuery( $query ); $items = $_CB_database->loadObjectList( null, 'cbgalleryItemTable', array( $_CB_database ) ); /** @var cbgalleryItemTable[] $items */ foreach ( $items as $item ) { $item->delete(); } } if ( ! parent::delete( $id ) ) { return false; } $_PLUGINS->trigger( 'gallery_onAfterDeleteFolder', array( $this ) ); return true; }
/** * @param null|int $id * @return bool */ public function delete( $id = null ) { global $_CB_framework, $_PLUGINS; $_PLUGINS->trigger( 'gj_onBeforeDeleteFile', array( &$this ) ); if ( ! parent::delete( $id ) ) { return false; } if ( $this->get( 'file' ) ) { $basePath = $_CB_framework->getCfg( 'absolute_path' ) . '/images/comprofiler/cbgroupjivefile'; $filePath = $basePath . '/' . (int) $this->group()->get( 'category' ) . '/' . (int) $this->group()->get( 'id' ); if ( file_exists( $filePath . '/' . $this->get( 'file' ) ) ) { @unlink( $filePath . '/' . $this->get( 'file' ) ); } } $_PLUGINS->trigger( 'gj_onAfterDeleteFile', array( $this ) ); return true; }
/** * @param null|int $id * @return bool */ public function delete( $id = null ) { global $_PLUGINS; $_PLUGINS->trigger( 'gj_onBeforeDeleteVideo', array( &$this ) ); if ( ! parent::delete( $id ) ) { return false; } $_PLUGINS->trigger( 'gj_onAfterDeleteVideo', array( $this ) ); return true; }
/** * @param null|int $id * @return bool */ public function delete( $id = null ) { global $_PLUGINS; $_PLUGINS->trigger( 'activity_onBeforeDeleteComment', array( &$this ) ); if ( ! parent::delete( $id ) ) { return false; } // Deletes activity about this comment: $query = 'SELECT *' . "\n FROM " . $this->getDbo()->NameQuote( '#__comprofiler_plugin_activity' ) . "\n WHERE " . $this->getDbo()->NameQuote( 'type' ) . " = " . $this->getDbo()->Quote( 'activity' ) . "\n AND " . $this->getDbo()->NameQuote( 'subtype' ) . " = " . $this->getDbo()->Quote( 'comment' ) . "\n AND " . $this->getDbo()->NameQuote( 'item' ) . " = " . (int) $this->get( 'id' ); $this->getDbo()->setQuery( $query ); $activities = $this->getDbo()->loadObjectList( null, '\CB\Plugin\Activity\Table\ActivityTable', array( $this->getDbo() ) ); /** @var ActivityTable[] $activities */ foreach ( $activities as $activity ) { $activity->delete(); } // Deletes comment replies: $query = 'SELECT *' . "\n FROM " . $this->getDbo()->NameQuote( '#__comprofiler_plugin_activity_comments' ) . "\n WHERE " . $this->getDbo()->NameQuote( 'type' ) . " = " . $this->getDbo()->Quote( 'comment' ) . "\n AND " . $this->getDbo()->NameQuote( 'item' ) . " = " . (int) $this->get( 'id' ); $this->getDbo()->setQuery( $query ); $replies = $this->getDbo()->loadObjectList( null, '\CB\Plugin\Activity\Table\CommentTable', array( $this->getDbo() ) ); /** @var CommentTable[] $replies */ foreach ( $replies as $reply ) { $reply->delete(); } $_PLUGINS->trigger( 'activity_onAfterDeleteComment', array( $this ) ); return true; }
/** * @param null|int $id * @return bool */ public function delete( $id = null ) { global $_PLUGINS; $_PLUGINS->trigger( 'gj_onBeforeDeleteUser', array( &$this ) ); if ( ! parent::delete( $id ) ) { return false; } static $params = null; if ( ! $params ) { $plugin = $_PLUGINS->getLoadedPlugin( 'user', 'cbgroupjive' ); $params = $_PLUGINS->getPluginParams( $plugin ); } if ( ( ! CBGroupJive::isModerator( $this->get( 'user_id' ) ) ) && $params->get( 'groups_delete', 1 ) ) { // Delete this users group invites (to and from): $query = 'SELECT *' . "\n FROM " . $this->getDbo()->NameQuote( '#__groupjive_invites' ) . "\n WHERE " . $this->getDbo()->NameQuote( 'group' ) . " = " . (int) $this->get( 'group' ) . "\n AND ( " . $this->getDbo()->NameQuote( 'user_id' ) . " = " . (int) $this->get( 'user_id' ) . "\n OR " . $this->getDbo()->NameQuote( 'user' ) . " = " . (int) $this->get( 'user_id' ) . " )"; $this->getDbo()->setQuery( $query ); $invites = $this->getDbo()->loadObjectList( null, '\CB\Plugin\GroupJive\Table\InviteTable', array( $this->getDbo() ) ); /** @var InviteTable[] $invites */ foreach ( $invites as $invite ) { $invite->delete(); } // Delete this users group notifications: $notification = new NotificationTable(); $notification->load( array( 'user_id' => (int) $this->get( 'user_id' ), 'group' => (int) $this->get( 'group' ) ) ); if ( $notification->get( 'id' ) ) { $notification->delete(); } } $_PLUGINS->trigger( 'gj_onAfterDeleteUser', array( $this ) ); return true; }
/** * @param null|int $id * @return bool */ public function delete( $id = null ) { global $_PLUGINS; //$_PLUGINS->trigger( 'invites_onBeforeDeleteInvite', array( &$this ) ); if ( ! parent::delete( $id ) ) { return false; } //$_PLUGINS->trigger( 'invites_onAfterDeleteInvite', array( $this ) ); return true; }
/** * @param null|int $id * @return bool */ public function delete( $id = null ) { global $_PLUGINS; $_PLUGINS->trigger( 'gj_onBeforeDeleteWall', array( &$this ) ); if ( ! parent::delete( $id ) ) { return false; } // Delete replies to this post: $query = 'SELECT *' . "\n FROM " . $this->getDbo()->NameQuote( '#__groupjive_plugin_wall' ) . "\n WHERE " . $this->getDbo()->NameQuote( 'reply' ) . " = " . (int) $this->get( 'id' ); $this->getDbo()->setQuery( $query ); $posts = $this->getDbo()->loadObjectList( null, '\CB\Plugin\GroupJiveWall\Table\WallTable', array( $this->getDbo() ) ); /** @var WallTable[] $posts */ foreach ( $posts as $post ) { $post->delete(); } $_PLUGINS->trigger( 'gj_onAfterDeleteWall', array( $this ) ); return true; }
/** * @param null|int $id * @return bool */ public function delete( $id = null ) { global $_PLUGINS; $_PLUGINS->trigger( 'gj_onBeforeDeleteEvent', array( &$this ) ); if ( ! parent::delete( $id ) ) { return false; } // Delete attendance to this event: $query = 'SELECT *' . "\n FROM " . $this->getDbo()->NameQuote( '#__groupjive_plugin_events_attendance' ) . "\n WHERE " . $this->getDbo()->NameQuote( 'event' ) . " = " . (int) $this->get( 'id' ); $this->getDbo()->setQuery( $query ); $users = $this->getDbo()->loadObjectList( null, '\CB\Plugin\GroupJiveEvents\Table\AttendanceTable', array( $this->getDbo() ) ); /** @var AttendanceTable[] $users */ foreach ( $users as $user ) { $user->delete(); } $_PLUGINS->trigger( 'gj_onAfterDeleteEvent', array( $this ) ); return true; }