Okey , Lets try to set FullName (custom field 5 for user Profile) as a mandatory field on registration:
- First you should go to config page and put FullName on Profile 5 name (config=>Custom fields for user profile =>Profile 5 name)
- Open register.php from gallery root , around line 69~82 you will find this:
$form_data = array(
array('label', $lang_register_php['required_info']),
array('input', 'username', $lang_register_php['username'], 25),
array('password', 'password', $lang_register_php['password'], 25),
array('password', 'password_verification', $lang_register_php['password_again'], 25),
array('input', 'email', $lang_register_php['email'], 255),
array('label', $lang_register_php['optional_info']),
array('input', 'user_profile1', $CONFIG['user_profile1_name'], 255),
array('input', 'user_profile2', $CONFIG['user_profile2_name'], 255),
array('input', 'user_profile3', $CONFIG['user_profile3_name'], 255),
array('input', 'user_profile4', $CONFIG['user_profile4_name'], 255),
array('input', 'user_profile5', $CONFIG['user_profile5_name'], 255),
array('textarea', 'user_profile6', $CONFIG['user_profile6_name'], 255)
);
Replace it with
$form_data = array(
array('label', $lang_register_php['required_info']),
array('input', 'username', $lang_register_php['username'], 25),
array('password', 'password', $lang_register_php['password'], 25),
array('password', 'password_verification', $lang_register_php['password_again'], 25),
array('input', 'email', $lang_register_php['email'], 255),
array('input', 'user_profile5', $CONFIG['user_profile5_name'], 255),// Added for fullname mandatory Mod
array('label', $lang_register_php['optional_info']),
array('input', 'user_profile1', $CONFIG['user_profile1_name'], 255),
array('input', 'user_profile2', $CONFIG['user_profile2_name'], 255),
array('input', 'user_profile3', $CONFIG['user_profile3_name'], 255),
array('input', 'user_profile4', $CONFIG['user_profile4_name'], 255),
// array('input', 'user_profile5', $CONFIG['user_profile5_name'], 255), // Commented for fullname mandatory Mod
array('textarea', 'user_profile6', $CONFIG['user_profile6_name'], 255)
);
- Around line 222~228 you will find this:
$email = trim(get_post_var('email'));
$profile1 = addslashes($_POST['user_profile1']);
$profile2 = addslashes($_POST['user_profile2']);
$profile3 = addslashes($_POST['user_profile3']);
$profile4 = addslashes($_POST['user_profile4']);
$profile5 = addslashes($_POST['user_profile5']);
$profile6 = addslashes($_POST['user_profile6']);
Replace it with this:
$email = trim(get_post_var('email'));
$profile5 = trim(get_post_var('user_profile5')); // Added for fullname mandatory Mod
$profile1 = addslashes($_POST['user_profile1']);
$profile2 = addslashes($_POST['user_profile2']);
$profile3 = addslashes($_POST['user_profile3']);
$profile4 = addslashes($_POST['user_profile4']);
// $profile5 = addslashes($_POST['user_profile5']); // Commented for fullname mandatory Mod
$profile6 = addslashes($_POST['user_profile6']);
- Put this
if (utf_strlen($profile5) < 2) $error .= '<li>' . "Full name must be 2 characters long minimum"; // Added for fullname mandatory Mod
right after this(around line 241~242):
if ($password != $password_again) $error .= '<li>' . $lang_register_php['err_password_mismatch'];
Now you are Done ....