Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. /* Build the form */
  2.         $form = new \IPS\Helpers\Form;
  3.         $form->addDummy( 'current_email', \IPS\Member::loggedIn()->email );
  4.         $form->add( new \IPS\Helpers\Form\Email( 'new_email', '', TRUE, array( 'accountEmail' => TRUE ) ) );
  5.         $form->add( new \IPS\Helpers\Form\Password( 'current_password', '', TRUE, array( 'validateFor' => \IPS\Member::loggedIn() ) ) );
  6.        
  7.         /* Handle submissions */
  8.         if ( $values = $form->values() )
  9.         {
  10.             /* Change the email */
  11.             foreach ( \IPS\Login::handlers( TRUE ) as $handler )
  12.             {
  13.                 /* We cannot update our email address in some login handlers, that's ok */
  14.                 try
  15.                 {
  16.                     $handler->changeEmail( \IPS\Member::loggedIn(), \IPS\Member::loggedIn()->email, $values['new_email'] );
  17.                 }
  18.                 catch( \BadMethodCallException $e ){}
  19.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement