forked from GNUsocial/gnu-social
		
	hook points for the email settings form
This commit is contained in:
		
							
								
								
									
										14
									
								
								EVENTS.txt
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								EVENTS.txt
									
									
									
									
									
								
							@@ -302,6 +302,20 @@ StartProfileSaveForm: before starting to save a profile settings form
 | 
				
			|||||||
EndProfileSaveForm: after saving a profile settings form (after commit, no profile or user object!)
 | 
					EndProfileSaveForm: after saving a profile settings form (after commit, no profile or user object!)
 | 
				
			||||||
- $action: action object being shown
 | 
					- $action: action object being shown
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					StartEmailFormData: just before showing text entry fields on email settings page
 | 
				
			||||||
 | 
					- $action: action object being shown
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EndEmailFormData: just after showing text entry fields on email settings page
 | 
				
			||||||
 | 
					- $action: action object being shown
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					StartEmailSaveForm: before starting to save a email settings form
 | 
				
			||||||
 | 
					- $action: action object being shown
 | 
				
			||||||
 | 
					- &$user: user being saved
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EndEmailSaveForm: after saving a email settings form (after commit)
 | 
				
			||||||
 | 
					- $action: action object being shown
 | 
				
			||||||
 | 
					- &$user: user being saved
 | 
				
			||||||
 | 
					
 | 
				
			||||||
StartRegistrationFormData: just before showing text entry fields on registration page
 | 
					StartRegistrationFormData: just before showing text entry fields on registration page
 | 
				
			||||||
- $action: action object being shown
 | 
					- $action: action object being shown
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -178,6 +178,8 @@ class EmailsettingsAction extends AccountSettingsAction
 | 
				
			|||||||
        $this->element('legend', null, _('Email preferences'));
 | 
					        $this->element('legend', null, _('Email preferences'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->elementStart('ul', 'form_data');
 | 
					        $this->elementStart('ul', 'form_data');
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					        if (Event::handle('StartEmailFormData', array($this))) {
 | 
				
			||||||
	    $this->elementStart('li');
 | 
						    $this->elementStart('li');
 | 
				
			||||||
	    $this->checkbox('emailnotifysub',
 | 
						    $this->checkbox('emailnotifysub',
 | 
				
			||||||
			    // TRANS: Checkbox label in e-mail preferences form.
 | 
								    // TRANS: Checkbox label in e-mail preferences form.
 | 
				
			||||||
@@ -223,6 +225,8 @@ class EmailsettingsAction extends AccountSettingsAction
 | 
				
			|||||||
			    _('Publish a MicroID for my email address.'),
 | 
								    _('Publish a MicroID for my email address.'),
 | 
				
			||||||
			    $user->emailmicroid);
 | 
								    $user->emailmicroid);
 | 
				
			||||||
	    $this->elementEnd('li');
 | 
						    $this->elementEnd('li');
 | 
				
			||||||
 | 
						    Event::handle('EndEmailFormData', array($this));
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
        $this->elementEnd('ul');
 | 
					        $this->elementEnd('ul');
 | 
				
			||||||
        // TRANS: Button label to save e-mail preferences.
 | 
					        // TRANS: Button label to save e-mail preferences.
 | 
				
			||||||
        $this->submit('save', _m('BUTTON','Save'));
 | 
					        $this->submit('save', _m('BUTTON','Save'));
 | 
				
			||||||
@@ -299,6 +303,10 @@ class EmailsettingsAction extends AccountSettingsAction
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    function savePreferences()
 | 
					    function savePreferences()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
						$user = common_current_user();
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (Event::handle('StartEmailSaveForm', array($this, &$user))) {
 | 
				
			||||||
 | 
						    
 | 
				
			||||||
	    $emailnotifysub   = $this->boolean('emailnotifysub');
 | 
						    $emailnotifysub   = $this->boolean('emailnotifysub');
 | 
				
			||||||
	    $emailnotifyfav   = $this->boolean('emailnotifyfav');
 | 
						    $emailnotifyfav   = $this->boolean('emailnotifyfav');
 | 
				
			||||||
	    $emailnotifymsg   = $this->boolean('emailnotifymsg');
 | 
						    $emailnotifymsg   = $this->boolean('emailnotifymsg');
 | 
				
			||||||
@@ -307,8 +315,6 @@ class EmailsettingsAction extends AccountSettingsAction
 | 
				
			|||||||
	    $emailmicroid     = $this->boolean('emailmicroid');
 | 
						    $emailmicroid     = $this->boolean('emailmicroid');
 | 
				
			||||||
	    $emailpost        = $this->boolean('emailpost');
 | 
						    $emailpost        = $this->boolean('emailpost');
 | 
				
			||||||
	    
 | 
						    
 | 
				
			||||||
        $user = common_current_user();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	    assert(!is_null($user)); // should already be checked
 | 
						    assert(!is_null($user)); // should already be checked
 | 
				
			||||||
	    
 | 
						    
 | 
				
			||||||
	    $user->query('BEGIN');
 | 
						    $user->query('BEGIN');
 | 
				
			||||||
@@ -334,9 +340,12 @@ class EmailsettingsAction extends AccountSettingsAction
 | 
				
			|||||||
	    
 | 
						    
 | 
				
			||||||
	    $user->query('COMMIT');
 | 
						    $user->query('COMMIT');
 | 
				
			||||||
	    
 | 
						    
 | 
				
			||||||
 | 
						    Event::handle('EndEmailSaveForm', array($this));
 | 
				
			||||||
 | 
						    
 | 
				
			||||||
	    // TRANS: Confirmation message for successful e-mail preferences save.
 | 
						    // TRANS: Confirmation message for successful e-mail preferences save.
 | 
				
			||||||
	    $this->showForm(_('Email preferences saved.'), true);
 | 
						    $this->showForm(_('Email preferences saved.'), true);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Add the address passed in by the user
 | 
					     * Add the address passed in by the user
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user