• Resolved Trisy123

    (@trisy123)


    I would like to validate a field to be a eight-digit number but am not sure how to implement this.

    I have found the follow code which should probably be implemented in my functions.php

    add_action( 'wpmem_pre_register_data', 'my_reg_hook' );
    function my_reg_hook( $fields )
    {
    }

    Two questions,

    Is this the correct hook to use for this? And how would I call one of my fields?

    The rest I’ll be able to figure out.

    https://www.ads-software.com/plugins/wp-members/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    Is this the correct hook to use for this?

    Yes.

    And how would I call one of my fields?

    $fields is an array of the fields where the array keys are their meta keys (the WP-Members field option name).

    If you have a field with option name my_number, then it will be in the array as $fields[‘my_number’]

    Thread Starter Trisy123

    (@trisy123)

    Thank you very much Chad. You’re the best!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Validating a specific field before submitting’ is closed to new replies.