Created
April 26, 2022 16:58
-
-
Save hivepress/232ba63de5115a56dc21cd7f64c6e52f to your computer and use it in GitHub Desktop.
Add first and last name fields to the user registration form #hivepress #users
This file contains hidden or 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 | |
| add_filter( | |
| 'hivepress/v1/forms/user_register', | |
| function ( $form ) { | |
| $form['fields'] = array_merge( | |
| $form['fields'], | |
| [ | |
| 'first_name' => [ | |
| 'required' => true, | |
| '_order' => 1, | |
| ], | |
| 'last_name' => [ | |
| 'required' => true, | |
| '_order' => 2, | |
| ], | |
| ] | |
| ); | |
| return $form; | |
| }, | |
| 100 | |
| ); | |
| add_action( | |
| 'hivepress/v1/models/user/register', | |
| function( $user_id, $values ) { | |
| if ( isset( $values['first_name'] ) ) { | |
| update_user_meta( $user_id, 'first_name', $values['first_name'] ); | |
| } | |
| if ( isset( $values['last_name'] ) ) { | |
| update_user_meta( $user_id, 'last_name', $values['last_name'] ); | |
| } | |
| }, | |
| 10, | |
| 2 | |
| ); | |
Author
I am with Bluhost and I tried clearing every cache known to man. It wasn't
it. OCCASIONALLY a hard refresh worked but it was random with mostly no
change. In regards to the snippet, I deleted all the snippets and it still
happened. It happened on different browsers but via my mobile it was ok. I
started over anyways but odd and frustrating.
…On Tue, Mar 11, 2025 at 5:59 PM HivePress ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Hi,
Please make sure that you removed the snippet. If you used the Code
Snippets plugin and it wasn't added to any of the theme/plugin files
directly, then clicking Delete on the snippet should be enough. Another
reason may be caching, e.g. if the hosting provider caches the website, or
there's a caching plugin in WordPress/Plugins.
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/hivepress/232ba63de5115a56dc21cd7f64c6e52f#gistcomment-5486577>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BQERKQUOTEP2S3UFTLYFIX32T5MEBBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTCNJZGU3DIOJYU52HE2LHM5SXFJTDOJSWC5DF>
.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Please make sure that you removed the snippet. If you used the Code Snippets plugin and it wasn't added to any of the theme/plugin files directly, then clicking Delete on the snippet should be enough. Another reason may be caching, e.g. if the hosting provider caches the website, or there's a caching plugin in WordPress/Plugins.