How do I make First and Last Names required fields please.

My Complimentary Membership Registration page is https://christiangays.com/membership-join/membership-registration/

How do I make First and Last Names required fields please.

  • Nastia
    • Support Rock Star

    Hello Mary,

    Sure, if you are using Buddypress plugin, please navigate from your dashboard to Users > Profile Fields.

    Edit the field, in the Requirement section set the settings to "Required".

    Please check the attached screenshot below:

    I hope this helps!

    Cheers,
    Nastia

  • Panos
    • SLS

    Hello Mary ,

    Hope you are having a nice weekend :slight_smile:

    I have also never used this plugin, but I checked it out just to see if what you require can be done. You can try editing file
    simple-membership/views/add.php
    and add
    class="validate[required]"
    to the input fields that you need to be required in order to complete sign up.

    Since you want to make first name and last name required then replace line ~23 from
    <td><input type="text" id="first_name" value="<?php echo $first_name; ?>" size="50" name="first_name" /></td>
    to
    <td><input type="text" id="first_name" class="validate[required]" value="<?php echo $first_name; ?>" size="50" name="first_name" /></td>

    and line ~27 from
    <td><input type="text" id="last_name" value="<?php echo $last_name; ?>" size="50" name="last_name" /></td>
    to
    <td><input type="text" id="last_name" class="validate[required]" value="<?php echo $last_name; ?>" size="50" name="last_name" /></td>

    Keep in mind that these modifications will be removed with every plugin update, so will have to repeat this with each update.

    Hope this helps you achieve what you were looking for :slight_smile:

    Kind regards,
    Panos

  • Mary
    • Wisp of the WP Loop

    Sorry Alex, I misunderstood. I thought that I had to add class="validate[required]" in addition to changing the code.

    I have done as suggested, cleared wp-rocket cache and browser cache, but it doesn't work. I fill in the registration form without first or last names, and I still get notification that my registration was successful.

  • Panos
    • SLS

    Hello Mary ,

    Apologies for not being more clear in my previous reply regarding where to insert the class.

    I just visited the registration page (yoursite.com/membership-join/membership-registration/) but I couldn't see that class in any of the elements. As I don't have access to your files I have attached the simple-membership/views/add.php file which you can download, unzip and replace the current one.

    Kind regards,
    Panos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.