Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

How to make Full name field required on registration page?

+1 vote
77 views
asked Oct 20 in Q2A Core by Back Bencher
Q2A version: 1.8
commented Oct 20 by arjunsuresh
You'll probably need to add a JavaScript check for it (also need to modify server code)

1 Answer

+4 votes
answered Oct 20 by esqeudero

You can do it with a simple custom plugin. 

First, go to admin -> users

Find, "Extra fields on user pages or registration form:"
do this: "Full name" -> edit field -> show on registration form

Then, create a custom plugin with only layer.php file. Plugin will have these files:

- qa-plugin.php

- my-layer.php

The qa-plugin.php should look like this:

<?php

if(!defined('QA_VERSION'))

{

header('Location: ../../');

exit;

}

// layer 

qa_register_plugin_layer('my-layer.php', 'my layer');

The my-layer.php file should look like this:

<?php

class qa_html_theme_layer extends qa_html_theme_base

{

public function form_field($field, $style) {

if ( $this->template == 'register' && $field['label'] == 'Full name:' ) {

$field['tags'] .= ' required';

}

qa_html_theme_base::form_field($field, $style);

}

This should work.

commented Oct 21 by Back Bencher
Thanks .....
commented Oct 21 by Donutlover
Good explanation +1
commented Oct 21 by pupi1985
Note this will only modify how it looks. It won't really make it required. You will need to reject the POST requests that don't contain that field
...