- while (list($uid, $hruid, $email, $prenom, $nom, $sexe, $fmt, $hash) = $res->next()) {
- $sent[] = "(user_id='$uid'" . (!$uid ? " AND email='$email')": ')');
- $this->sendTo($hruid, $email, $prenom, $nom, $sexe, $fmt=='html', $hash);
+ $users = User::getBulkUsersWithUIDs(XDB::fetchColumn($query));
+ if (count($users) == 0) {
+ return $emailsCount;
+ }
+ foreach ($users as $user) {
+ $sent[] = $user->id();
+ $this->sendTo($user, $hash);
+ ++$emailsCount;