| @@ -60,9 +60,9 @@ | ||
| 60 | 60 | $this->breadcrumb[$data['user-information']->email] = acym_completeLink('users&task=edit&userId='.$userId); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | if (empty($data['user-information']->language)) { |
| 64 | - $data['user-information']->language = acym_getLanguageTag(); | |
| 64 | + $data['user-information']->language = acym_getDefaultUserLanguage(); | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | return true; |
| 68 | 68 | } |
| @@ -132,10 +132,12 @@ | ||
| 132 | 132 | private function prepareStatsEdit(array &$data, int $userId): void |
| 133 | 133 | { |
| 134 | 134 | $data['percentageOpen'] = 0; |
| 135 | 135 | $data['percentageClick'] = 0; |
| 136 | + $data['anonymousStats'] = !empty($this->config->get('anonymous_stats', 0)); | |
| 136 | 137 | |
| 137 | - if (empty($userId)) return; | |
| 138 | + // Individual open/click rates are an individual statistic: don't compute them when anonymizing | |
| 139 | + if (empty($userId) || $data['anonymousStats']) return; | |
| 138 | 140 | |
| 139 | 141 | $userStatClass = new UserStatClass(); |
| 140 | 142 | $userStatFromDB = $userStatClass->getAllUserStatByUserId($userId); |
| 141 | 143 | |
| @@ -223,8 +225,9 @@ | ||
| 223 | 225 | if ($value->disabled == 'y') $valueTmp->disable = true; |
| 224 | 226 | $valuesArray[$value->value] = $valueTmp; |
| 225 | 227 | } |
| 226 | 228 | } |
| 229 | + | |
| 227 | 230 | if (!empty($fieldDB) && !empty($fieldDB->value)) { |
| 228 | 231 | $fromDB = $fieldClass->getValueFromDB($fieldDB); |
| 229 | 232 | foreach ($fromDB as $value) { |
| 230 | 233 | $valuesArray[$value->value] = $value->title; |
| @@ -231,15 +234,15 @@ | ||
| 231 | 234 | } |
| 232 | 235 | } |
| 233 | 236 | |
| 234 | 237 | $one->display = empty($one->option->display) ? '' : json_decode($one->option->display); |
| 235 | - $data['allFields'][$one->id] = $one; | |
| 238 | + | |
| 236 | 239 | if ($one->id == 1) { |
| 237 | 240 | $defaultValue = empty($data['user-information']->id) ? '' : $data['user-information']->name; |
| 238 | 241 | } elseif ($one->id == 2) { |
| 239 | 242 | $defaultValue = empty($data['user-information']->id) ? '' : $data['user-information']->email; |
| 240 | 243 | } elseif ($one->id == $languageFieldId) { |
| 241 | - $defaultValue = empty($data['user-information']->id) ? acym_getLanguageTag() : $data['user-information']->language; | |
| 244 | + $defaultValue = empty($data['user-information']->id) ? acym_getDefaultUserLanguage() : $data['user-information']->language; | |
| 242 | 245 | } elseif ( |
| 243 | 246 | isset($data['fieldsValues'][$one->id]) |
| 244 | 247 | && ( |
| 245 | 248 | ( |
| @@ -260,19 +263,15 @@ | ||
| 260 | 263 | } else { |
| 261 | 264 | $defaultValue = $one->default_value; |
| 262 | 265 | } |
| 263 | 266 | |
| 264 | - ob_start(); | |
| 265 | - $fieldClass->displayField( | |
| 266 | - $one, | |
| 267 | - $defaultValue, | |
| 268 | - $valuesArray, | |
| 269 | - true, | |
| 270 | - !acym_isAdmin(), | |
| 271 | - $data['user-information'], | |
| 272 | - $one->$fieldVisibility != 0 | |
| 273 | - ); | |
| 274 | - $data['allFields'][$one->id]->html = ob_get_clean(); | |
| 267 | + $data['allFields'][$one->id] = [ | |
| 268 | + 'field' => $one, | |
| 269 | + 'defaultValue' => $defaultValue, | |
| 270 | + 'values' => $valuesArray, | |
| 271 | + 'user' => $data['user-information'], | |
| 272 | + 'showField' => $one->$fieldVisibility != 0, | |
| 273 | + ]; | |
| 275 | 274 | } |
| 276 | 275 | } |
| 277 | 276 | |
| 278 | 277 | public function save(): void |