Helpful Information
 
 
Category: vBulletin 2.x Beta Releases
Force users to complete new required fields

Hey guys, first post here, as I have only been using/running vb for a little over a week now.

Basically I added some new required fields for users, so I wanted a way to make users fill out the new fields before they could use the site.

It is real simple, and only requires adding a block of code to the global.php file and adding an error template.

First, in global.php, find "$logincode=makelogincode();" (should be the last before ?>)
And underneath it add:


if ($bbuserinfo[userid]!=0 && !strchr($REQUEST_URI, "usercp.php") && !strchr($REQUEST_URI, "member.php")) {
$reqfields=$DB_site->query("SELECT * FROM profilefield WHERE required=1");

if ($DB_site->num_rows($reqfields)) {
while ($reqfield=$DB_site->fetch_array($reqfields)) {
$ufields=$DB_site->query_first("SELECT * FROM userfield WHERE userid='$bbuserinfo[userid]'");
$fieldname="field$reqfield[profilefieldid]";
$field=$ufields[$fieldname];
if(empty($field)) {
eval("standarderror(\"".gettemplate('error_emptyreqfields')."\");");
exit;
}
}
}
}


Then create a new template called "error_emptyreqfields" containing:

We have added new required profile field(s) since your last visit. Please click <a href="member.php?s=$session[sessionhash]&action=editprofile">here</a> to update your profile.


Basically, once they log in, they wont be able to do anything but go to their profile until the fields are completed.

If I posted this in the wrong forum or in the wrong format, I am sorry.

do u mean it forces people who are registerin to fill them in? or already registered users to go and fill the new fields in?

For users that had registered prior to you adding the required fields.

how do we force the users to enter their birthdates?

i am also using the country flags hack as well as the gender hack. how do i force them to update those?

any advice is appreciated. thanks in advance.










privacy (GDPR)