// get users
$users = array();
- $userIDs = UserBirthdayCache::getInstance()->getBirthdays($month, $day);
- $userList = new UserProfileList();
- $userList->setObjectIDs($userIDs);
- $userList->readObjects();
- foreach ($userList->getObjects() as $user) {
- if (!$user->isProtected() && $user->getAge($year) >= 0) {
- $users[] = $user;
+ $userOptions = UserOptionCacheBuilder::getInstance()->getData(array(), 'options');
+ if (isset($userOptions['birthday'])) {
+ $birthdayUserOption = $userOptions['birthday'];
+
+ $userIDs = UserBirthdayCache::getInstance()->getBirthdays($month, $day);
+ $userList = new UserProfileList();
+ $userList->setObjectIDs($userIDs);
+ $userList->readObjects();
-
++
+ foreach ($userList->getObjects() as $user) {
+ $birthdayUserOption->setUser($user->getDecoratedObject());
-
++
+ if (!$user->isProtected() && $birthdayUserOption->isVisible() && $user->getAge($year) >= 0) {
- $users[] = $user;
++ $users[] = $user;
+ }
}
}
<?php
namespace wcf\system\dashboard\box;
-use wcf\data\dashboard\box\DashboardBox;
+use wcf\data\dashboard\box\DashboardBox;
use wcf\data\user\UserProfileList;
-use wcf\page\IPage;
+use wcf\page\IPage;
+ use wcf\system\cache\builder\UserOptionCacheBuilder;
use wcf\system\user\UserBirthdayCache;
use wcf\system\WCF;
use wcf\util\DateUtil;
$userIDs = UserBirthdayCache::getInstance()->getBirthdays($date[1], $date[2]);
if (!empty($userIDs)) {
- $userProfileList = new UserProfileList();
- $userProfileList->setObjectIDs($userIDs);
- $userProfileList->readObjects();
- $i = 0;
- foreach ($userProfileList as $userProfile) {
- if ($i == 10) break;
+ $userOptions = UserOptionCacheBuilder::getInstance()->getData(array(), 'options');
+ if (isset($userOptions['birthday'])) {
+ $birthdayUserOption = $userOptions['birthday'];
- if (!$userProfile->isProtected() && substr($userProfile->birthday, 5) == $currentDay) {
- $this->userProfiles[] = $userProfile;
- $i++;
+ $userProfileList = new UserProfileList();
+ $userProfileList->setObjectIDs($userIDs);
+ $userProfileList->readObjects();
+ $i = 0;
+ foreach ($userProfileList as $userProfile) {
- if ($i == 5) break;
++ if ($i == 10) break;
+
+ $birthdayUserOption->setUser($userProfile->getDecoratedObject());
-
++
+ if (!$userProfile->isProtected() && $birthdayUserOption->isVisible() && substr($userProfile->birthday, 5) == $currentDay) {
+ $this->userProfiles[] = $userProfile;
+ $i++;
+ }
}
}
}