Elgg  Version master
SaveUserSettingsHandler.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Email;
4 
11 
19  public function __invoke(\Elgg\Event $event): void {
20  $user = $event->getUserParam();
21  if (!$user instanceof \ElggUser || !$user->canEdit() || !(bool) elgg_get_config('enable_delayed_email')) {
22  return;
23  }
24 
25  $delayed_email_interval = get_input('delayed_email_interval');
26  if (empty($delayed_email_interval)) {
27  return;
28  }
29 
30  if ($user->delayed_email_interval === $delayed_email_interval) {
31  // no change
32  return;
33  }
34 
35  // save new setting
36  $user->delayed_email_interval = $delayed_email_interval;
37 
38  // update all queued notifications to the new interval
39  _elgg_services()->delayedEmailQueueTable->updateRecipientInterval($user->guid, $delayed_email_interval);
40  }
41 }
$user
Definition: ban.php:7
Save the user setting for delayed email interval.
__invoke(\Elgg\Event $event)
Handle the saving of the user settings.
Models an event passed to event handlers.
Definition: Event.php:11
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
_elgg_services()
Get the global service provider.
Definition: elgglib.php:353
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20