Title: Passcode field on registration
Last modified: July 29, 2022

---

# Passcode field on registration

 *  Resolved [rinh](https://wordpress.org/support/users/rinh/)
 * (@rinh)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/passcode-field-on-registration/)
 * Hi
    I wonder if it would be possible to make a field on registration form where
   the user has to put in the correct numbers?
 * As an example I’d like to create a form field where the user has to put in 1234,
   and it’ll only be valid if they put in 1234.
 * I think this page is on the track to what I’d like [https://docs.ultimatemember.com/article/94-apply-custom-validation-to-a-field](https://docs.ultimatemember.com/article/94-apply-custom-validation-to-a-field)
   but I don’t know PHP to be able to change those examples.
 * Thank you in advance.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [missveronica](https://wordpress.org/support/users/missveronicatv/)
 * (@missveronicatv)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/passcode-field-on-registration/#post-15870368)
 * [@rinh](https://wordpress.org/support/users/rinh/)
 * Have you seen this example of solution for your issue?
 * [https://docs.ultimatemember.com/article/68-stop-registration-if-customercode-field-does-not-equal-abcde](https://docs.ultimatemember.com/article/68-stop-registration-if-customercode-field-does-not-equal-abcde)
 * `customer_code` is your meta-key field in the Registration Form
    Replace `ABCDE`
   with your value `1234`
 *  Thread Starter [rinh](https://wordpress.org/support/users/rinh/)
 * (@rinh)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/passcode-field-on-registration/#post-15870440)
 * I hadn’t seen that one, thank you!
 * From a quick look that seems to do exactly what I’m looking for. I’ll give it
   a try as soon as I can.
 *  Thread Starter [rinh](https://wordpress.org/support/users/rinh/)
 * (@rinh)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/passcode-field-on-registration/#post-15870520)
 * This worked great, thank you.
 * Is there a way to edit the message ‘An error has occured’ when putting in the
   wrong passcode, to something like ‘Please put in the correcct passcode’?
 * Also in the validate option for the field I put it to Unique Metakey value. I’m
   not sure I was supposed to do that or if there should be something else.
 * Thank you in advance.
 *  [missveronica](https://wordpress.org/support/users/missveronicatv/)
 * (@missveronicatv)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/passcode-field-on-registration/#post-15870562)
 * [@rinh](https://wordpress.org/support/users/rinh/)
 * You can try this code snippet:
 *     ```
       add_action( 'um_submit_form_errors_hook', 'check_customer_code', 100, 1 );
       function check_customer_code( $args ){
   
       	if ( isset( $args['customer_code'] ) && $args['customer_code'] != '1234' ) {
               UM()->form()->add_error( 'customer_code', 'Please put in the correcct passcode' );
           } 
       }
       ```
   
 * Don’t use `Unique Metakey value`.
    Setting `Numeric value only` might guide those
   without the right number code.
 *  Thread Starter [rinh](https://wordpress.org/support/users/rinh/)
 * (@rinh)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/passcode-field-on-registration/#post-15870628)
 * Wonderful, worked out really well.
 * Thank you again for all the help.
 *  Plugin Support [Ultimate Member Support](https://wordpress.org/support/users/ultimatemembersupport/)
 * (@ultimatemembersupport)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/passcode-field-on-registration/#post-15897061)
 * Thanks for letting us know. I’m marking this as resolved now.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Passcode field on registration’ is closed to new replies.

 * ![](https://ps.w.org/ultimate-member/assets/icon-256x256.png?rev=3160947)
 * [Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin](https://wordpress.org/plugins/ultimate-member/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-member/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-member/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-member/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-member/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-member/reviews/)

 * 6 replies
 * 3 participants
 * Last reply from: [Ultimate Member Support](https://wordpress.org/support/users/ultimatemembersupport/)
 * Last activity: [3 years, 9 months ago](https://wordpress.org/support/topic/passcode-field-on-registration/#post-15897061)
 * Status: resolved