/**
	 * stores user status to database
	 *
	 * @param int $status
	 * @return boolean
	 */
	public function setStatus( $status ) {
		global $_CB_framework, $_PLUGINS;

		$plugin				=	cbgjClass::getPlugin();
		$user				=&	CBuser::getUserDataInstance( $_CB_framework->myId() );

		$_PLUGINS->trigger( 'gj_onBeforeUpdateUserStatus', array( &$status, &$this, $this->getGroup(), $this->getCategory(), $user, $plugin ) );

		$this->set( 'status', (int) $status );

		if ( ! parent::store() ) {
			return false;
		}

		$_PLUGINS->trigger( 'gj_onAfterUpdateUserStatus', array( $this->get( 'status' ), $this, $this->getGroup(), $this->getCategory(), $user, $plugin ) );

		if ( in_array( $this->get( 'status' ), array( -1, 0 ) ) ) {
			$notifications	=	$this->getNotifications();

			if ( $notifications ) foreach ( $notifications as $notification ) {
				if ( ! $notification->delete() ) {
					return false;
				}
			}
		} else {
			cbgjClass::resetCache( true );
			cbgjClass::saveNotifications( $this->getCategory()->get( 'id' ), $this->get( 'group' ), $this->getOwner(), $plugin );
		}

		return true;
	}
	/**
	 * resaves users fixing various issues
	 *
	 * @param string $mode
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 */
	private function fixUsers( $mode, $user, $plugin ) {
		$users						=	cbgjData::getUsers();

		if ( ! $users ) {
			cbgjClass::getPluginURL( array( 'tools' ), CBTxt::T( 'No users found to fix.' ), false, true, 'error' );
		}

		switch ( $mode ) {
			case 'notifications':
				foreach ( $users as $usr ) {
					$notification	=	cbgjData::getNotifications( null, array( array( 'type', '=', 'group' ), array( 'item', '=', (int) $usr->get( 'group' ) ), array( 'user_id', '=', (int) $usr->get( 'user_id' ) ) ), null, null, false );

					if ( ( ! $notification->get( 'id' ) ) && ( $usr->get( 'status' ) > 0 ) && cbgjClass::hasAccess( 'grp_usr_notifications', cbgjClass::getAuthorization( $usr->getCategory(), $usr->getGroup(), $usr->getOwner() ) ) ) {
						cbgjClass::saveNotifications( $usr->getCategory()->get( 'id' ), $usr->get( 'group' ), $usr->getOwner(), $plugin );
					}
				}
				break;
		}

		cbgjClass::getPluginURL( array( 'tools' ), CBTxt::T( 'Users fixed successfully!' ), false, true );
	}