Jump to content

IPS4 Hook into pre and post registration


Recommended Posts

Posted

First, lets start off by saying I love IPS4. That being said, the documentation and guides available for it are far and few between =(

 

I'm trying to create a plugin to hook into Pre and Post registration

 

The only thing I've found is being able to hook into post registration when it calls to send a verification email, and when the account has been verified(which is not run if no verification is required)

I can't find anything on pre-registration where I can validate a custom field

Posted
Just now, Adriano Faria said:

By pre-registration you mean the registration form, when the user clicks the button to create the account ?

Yes sir!

Posted

I'm not sure how to do this with profile fields. Does it have to be a profile field? If you use a text box, for example, you validate it on the form, like that:

			$form->add( new \IPS\Helpers\Form\Text( 'blog_name', $this->id ? $this->_title : NULL, FALSE, array(), function( $value ) {
				if ( \IPS\Request::i()->blog_type === 'member' AND !$value )
				{
					throw new \InvalidArgumentException( 'form_required' );
				}
			}, NULL, NULL, 'blog_name' ) );

That will throw an error and won't accept the registration.

Posted

Take a look in this plugin. It extends the registration screen to add the birthday:

Instead of using $form->add( new \IPS\Helpers\Form\Custom, you will use $form->add( new \IPS\Helpers\Form\Text and add the validation as the above example.

You don't have to use the _createMember method. You need only if you want to add information.

Posted

If you still need to run post-registration code, you can add a member sync plugin to an application and add your code to onCreateAccount() or onValidate() depending on your needs.

Archived

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

  • Recently Browsing   0 members

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