Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Build the form */
- $form = new \IPS\Helpers\Form;
- $form->addDummy( 'current_email', \IPS\Member::loggedIn()->email );
- $form->add( new \IPS\Helpers\Form\Email( 'new_email', '', TRUE, array( 'accountEmail' => TRUE ) ) );
- $form->add( new \IPS\Helpers\Form\Password( 'current_password', '', TRUE, array( 'validateFor' => \IPS\Member::loggedIn() ) ) );
- /* Handle submissions */
- if ( $values = $form->values() )
- {
- /* Change the email */
- foreach ( \IPS\Login::handlers( TRUE ) as $handler )
- {
- /* We cannot update our email address in some login handlers, that's ok */
- try
- {
- $handler->changeEmail( \IPS\Member::loggedIn(), \IPS\Member::loggedIn()->email, $values['new_email'] );
- }
- catch( \BadMethodCallException $e ){}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement