How to mark some fields in user-info as required fields
Posted July 2nd 2014, 2:05am
In user-info of phpBB3 has many fields such as ICQ account, AIM account, MSN account, Jabber account, Website, Location, Occupation, Interests, Birthday.

I want to mark some of these fields as required fields when users register.

Thanks for any help.
φ
Posts: 35
Joined: May 23rd 2013, 9:51pm
Likes Received: 1
How to mark some fields in user-info as required fields
Posted July 2nd 2014, 5:16pm
Adding the optional profile fields to the registration form would require a MOD. I'm sure something has been written for this...have you done a Google search?

Otherwise, it would be fairly easy to write. Just take the appropriate field data from the ucp_profile_profile_info.html template and add it to the ucp_register.html template, then add the correct verification code in includes/ucp/ucp_register.php.
φ
Posts: 1600
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
1
#3
How to mark some fields in user-info as required fields
Posted July 2nd 2014, 10:12pm
I have searched in phpBB forum but find no solution solving the problem.
Thanks for your guide and hope you have time to modify the above file

The below solution of "I M lost" works for field "Location", but still not mark this field as * in user-info then user can clear it easily!

In file:
includes/ucp/ucp_register.php

Find:
      $data = array(
'username' => utf8_normalize_nfc(request_var('username', '', true)),
'new_password' => request_var('new_password', '', true),


Add After:
// Location Required For Registration
'location' => request_var('location', '', true),
// Location Required For Registration


Find:
            'email'            => array(
array('string', false, 6, 60),
array('email')),
'email_confirm' => array('string', false, 6, 60),


Add After:
// Location Required For Registration
'location' => array('string', false, 5, 60),
// Location Required For Registration


Find:
            $user_row = array(
'username' => $data['username'],
'user_password' => phpbb_hash($data['new_password']),
'user_email' => $data['email'],

Add After:
// Location Required For Registration
'user_from' => $data['location'],
// Location Required For Registration


Find:
      $template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
'USERNAME' => $data['username'],
'PASSWORD' => $data['new_password'],
'PASSWORD_CONFIRM' => $data['password_confirm'],

Add After:
// Location Required For Registration
'LOCATION' => $data['location'],
// Location Required For Registration


In File: styles/prosilver/template/ucp_register.html
Find:
   <dl>
<dt><label for="new_password">{L_PASSWORD}:</label><br /><span>{L_PASSWORD_EXPLAIN}</span></dt>
<dd><input type="password" tabindex="4" name="new_password" id="new_password" size="25" value="{PASSWORD}" class="inputbox autowidth" title="{L_NEW_PASSWORD}" /></dd>
</dl>
<dl>
<dt><label for="password_confirm">{L_CONFIRM_PASSWORD}:</label></dt>
<dd><input type="password" tabindex="5" name="password_confirm" id="password_confirm" size="25" value="{PASSWORD_CONFIRM}" class="inputbox autowidth" title="{L_CONFIRM_PASSWORD}" /></dd>
</dl>

Add After:
   <dl>
<dt><label for="location">{L_LOCATION}:</label><br /></dt>
<dd><input type="text" tabindex="4" name="location" id="location" size="25" value="{LOCATION}" class="inputbox autowidth" title="{LOCATION}" /></dd>
</dl>
φ
Posts: 35
Joined: May 23rd 2013, 9:51pm
Likes Received: 1

Who is online

Users browsing this forum: No registered users and 0 guests