cosmetic nullsafe fix

This commit is contained in:
Jean-Christian Denis 2023-04-21 00:14:29 +02:00
parent ff63c5a582
commit cebab2b456
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951

View file

@ -26,6 +26,11 @@ class BackendBehaviors
{ {
public static function adminUserForm(): void public static function adminUserForm(): void
{ {
// nullsafe PHP < 8.0
if (is_null(dcCore::app()->auth)) {
return;
}
$options = dcCore::app()->auth->getOptions(); $options = dcCore::app()->auth->getOptions();
echo echo
@ -43,6 +48,9 @@ class BackendBehaviors
public static function adminBeforeUserUpdate(cursor $cur, string $user_id = ''): void public static function adminBeforeUserUpdate(cursor $cur, string $user_id = ''): void
{ {
$cur->user_options['notify_comments'] = $_POST['notify_comments']; $opt = $cur->getField('user_options');
$opt = is_null($opt) ? [] : $opt;
$opt['notify_comments'] = $_POST['notify_comments'];
$cur->setField('user_options', $opt);
} }
} }