Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[3.0] Fixes bugs when saving PM settings #8465

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Sources/Actions/PersonalMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ public function settings(): void
if (isset($_REQUEST['save'])) {
User::$me->checkSession();
Profile::$member->save();
Utils::redirectexit('action=pm;sa=settings');
}

Profile::$member->setupContext(['pm_prefs']);
Expand Down
4 changes: 2 additions & 2 deletions Sources/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,7 @@ public function save(): void
// This allows variables to call activities when they save.
Utils::$context['profile_execute_on_save'] = [];

if (User::$me->is_owner && in_array(Menu::$loaded['profile']->current_area, ['account', 'forumprofile', 'theme'])) {
if (User::$me->is_owner && in_array(Menu::$loaded['profile']->current_area ?? null, ['account', 'forumprofile', 'theme'])) {
Utils::$context['profile_execute_on_save']['reload_user'] = [__CLASS__ . '::reloadUser', Profile::$member->id];
}

Expand All @@ -1555,7 +1555,7 @@ public function save(): void
$this->prepareToSaveCustomFields($_REQUEST['sa'] ?? null);

// Give hooks some access to the save data.
IntegrationHook::call('integrate_profile_save', [&Profile::$member->new_data, &Profile::$member->save_errors, Profile::$member->id, Profile::$member->data, Menu::$loaded['profile']->current_area]);
IntegrationHook::call('integrate_profile_save', [&Profile::$member->new_data, &Profile::$member->save_errors, Profile::$member->id, Profile::$member->data, Menu::$loaded['profile']->current_area ?? null]);

// There was a problem. Let them try again.
if (!empty($this->save_errors)) {
Expand Down