Jump to content

Can't extend the 'Compllete Registration' form


Adriano Faria

Recommended Posts

Need to add a new field on "Complete Registration" form but I can't:

		/* Build the form */
		$form = new \IPS\Helpers\Form( 'form', 'register_button' );
		if( !\IPS\Member::loggedIn()->real_name OR \IPS\Member::loggedIn()->name === \IPS\Member::loggedIn()->language()->get('guest') )
		{
			$form->add( new \IPS\Helpers\Form\Text( 'username', NULL, TRUE, array( 'accountUsername' => \IPS\Member::loggedIn() ) ) );
		}

		if( !\IPS\Member::loggedIn()->email )
		{
			$form->add( new \IPS\Helpers\Form\Email( 'email_address', NULL, TRUE, array( 'accountEmail' => TRUE ) ) );
		}

		$form->addButton( 'cancel', 'link', \IPS\Http\Url::internal( 'app=core&module=system&controller=register&do=cancel', 'front', 'register' )->csrf() );

		\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'system' )->completeProfile( $form );

Capturar.png

Link to comment
Share on other sites

You can.

\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'system' )->completeProfile( $form );

You got lucky! The form is being passed in as an object instead of as (string)$form. Do a theme hook on front:system, then in PHP mode, overload the completeProfile method. You should be able to make changes to the form in there, then call the parent.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...