Start and End EmailFormData events include current profile

This commit is contained in:
Mikael Nordfeldth 2014-07-13 15:29:58 +02:00
parent a9bfa1979d
commit c8873de08b
3 changed files with 10 additions and 9 deletions

View File

@ -290,11 +290,13 @@ StartProfileSaveForm: before starting to save a profile settings form
EndProfileSaveForm: after saving a profile settings form (after commit, no profile or user object!)
- $action: action object being shown
StartEmailFormData: just before showing text entry fields on email settings page
- $action: action object being shown
StartEmailFormData: just before showing form input fields on email settings page
- $action: Action object being shown
- $scoped: Profile for whom settings are being configured
EndEmailFormData: just after showing text entry fields on email settings page
EndEmailFormData: just after showing form input fields on email settings page
- $action: action object being shown
- $scoped: Profile for whom settings are being configured
StartEmailSaveForm: before starting to save a email settings form
- $action: action object being shown

View File

@ -206,7 +206,7 @@ class EmailsettingsAction extends SettingsAction
$this->elementStart('ul', 'form_data');
if (Event::handle('StartEmailFormData', array($this))) {
if (Event::handle('StartEmailFormData', array($this, $this->scoped))) {
$this->elementStart('li');
$this->checkbox('emailnotifysub',
// TRANS: Checkbox label in e-mail preferences form.
@ -244,7 +244,7 @@ class EmailsettingsAction extends SettingsAction
_('Publish a MicroID for my email address.'),
$user->emailmicroid);
$this->elementEnd('li');
Event::handle('EndEmailFormData', array($this));
Event::handle('EndEmailFormData', array($this, $this->scoped));
}
$this->elementEnd('ul');
// TRANS: Button label to save e-mail preferences.

View File

@ -96,18 +96,17 @@ class EmailSummaryPlugin extends Plugin
* Add a checkbox to turn off email summaries
*
* @param Action $action Action being executed (emailsettings)
* @param Profile $scoped Profile for whom settings are configured (current user)
*
* @return boolean hook value
*/
function onEndEmailFormData($action)
public function onEndEmailFormData(Action $action, Profile $scoped)
{
$user = common_current_user();
$action->elementStart('li');
$action->checkbox('emailsummary',
// TRANS: Checkbox label in e-mail preferences form.
_m('Send me a periodic summary of updates from my network'),
Email_summary_status::getSendSummary($user->id));
Email_summary_status::getSendSummary($scoped->id));
$action->elementEnd('li');
return true;
}