protected function readDefaultValues() {
$this->username = $this->user->username;
$this->email = $this->confirmEmail = $this->user->email;
- $this->groupIDs = $this->user->getGroupIDs();
+ $this->groupIDs = $this->user->getGroupIDs(true);
$this->languageID = $this->user->languageID;
}
/**
* Returns an array with all the groups in which the actual user is a member.
- *
+ *
+ * @param boolean $skipCache
* @return array $groupIDs
*/
- public function getGroupIDs() {
- if ($this->groupIDs === null) {
+ public function getGroupIDs($skipCache = false) {
+ if ($this->groupIDs === null || $skipCache) {
if (!$this->userID) {
// user is a guest, use default guest group
$this->groupIDs = UserGroup::getGroupIDsByType(array(UserGroup::GUESTS, UserGroup::EVERYONE));
$data = UserStorageHandler::getInstance()->getStorage(array($this->userID), 'groupIDs');
// cache does not exist or is outdated
- if ($data[$this->userID] === null) {
+ if ($data[$this->userID] === null || $skipCache) {
$this->groupIDs = array();
$sql = "SELECT groupID
FROM wcf".WCF_N."_user_to_group
}
// update storage data
- UserStorageHandler::getInstance()->update($this->userID, 'groupIDs', serialize($this->groupIDs), 1);
+ if (!$skipCache) {
+ UserStorageHandler::getInstance()->update($this->userID, 'groupIDs', serialize($this->groupIDs), 1);
+ }
}
else {
$this->groupIDs = unserialize($data[$this->userID]);
*
* @param array $userIDs
* @return array<User>
- */
+ */
public static function getUsers(array $userIDs) {
$userList = new UserList();
$userList->getConditionBuilder()->add("user_table.userID IN (?)", array($userIDs));
* Returns username.
*
* @return string
- */
+ */
public function __toString() {
return $this->username;
}