Skip to:
Content
Pages
Categories
Search
Top
Bottom

How can I require the WordPress Biography field on a registration form?

  • @tuckeror

    Participant

    I am using Extended Profile for a user registration form. I’d like to use the default WordPress bio field (Biographical info). I am able to add it in the Extended Profile settings (under Type -> WordPress Fields -> Biography), but there is no option to require it. I can make other fields required. How could I go about making that field required?

    WordPress 6.5.4
    BuddyPress 12.5.0

Viewing 1 replies (of 1 total)
  • @davesumpter

    Participant

    Try this in the functions.php file of your child theme. I have put 777 as filed id but you will have to put in the correct field id and the correct field name:-

    function validate_required_profile_fields() {
    $required_fields = [
    ‘field_777’ => ‘The so and so field is required.’,
    ];

    foreach ( $required_fields as $field_key => $error_message ) {
    if ( empty( $_POST[ $field_key ] ) ) {
    bp_core_add_message( $error_message, ‘error’ );
    }
    }
    }
    add_action( ‘bp_signup_validate’, ‘validate_required_profile_fields’ );

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar