Created
October 12, 2017 13:33
-
-
Save spivurno/ad05a8543ea6b2a6a4845f1caf1fe675 to your computer and use it in GitHub Desktop.
Gravity Perks // GP Unique ID // Use Unique ID as User Registration Password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Gravity Perks // GP Unique ID // Use Unique ID as User Registration Password | |
* http://gravitywiz.com/documentation/gravity-forms-unique-id/ | |
*/ | |
add_filter( 'gform_userregistration_feed_settings_fields', function( $fields, $form ) { | |
foreach( $fields['user_settings']['fields'] as &$field ) { | |
if( $field['name'] == 'password' ) { | |
$field['args']['input_types'][] = 'uid'; | |
} | |
} | |
return $fields; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, Is it possible to generate a password, username and email address with UniqueID and forward it to the Gravity Forms User Registration Addon? In the form I created UniqueID-email (I added suffix @ exaemple.com), UniqueID-password, UniqueID-username.
I am completing the test form and all generated unique data are correctly saved.
However, if I activate User Registratio for this form, unfortunately I get an error that the form has not been completed correctly.
Of course, I added your code + additionally this:
if ($ field ['name'] == 'email') {
$ field ['args'] ['input_types'] [] = 'uid';
}
if ($ field ['name'] == 'username') {
$ field ['args'] ['input_types'] [] = 'uid';
}
Then in the Registration Settings of the form I can assign those generated by UniqueID to the username, password and email respectively, but unfortunately I get an error when trying to submit such a form.
In the source code of the page I see:
"validation_message_1_5" class = "gfield_description validation_message" aria-live = "polite"> The email address can not be empty
So as if the email address was empty. I'm doing something wrong?