wes_517 |
12-01-2006 01:52 AM |
While trying to find something that will require moderation before giving access to the group, I saw a few people were interested, here's one version of code, it may not be pretty, but it works...
it also doesn't email out, but it does the job.
when they register, if field 23 is a hit, it adds them into the moderation table of the database.
PHP Code:
// Get the value for field 23
$user = $db->query_first("
SELECT field23
FROM " . TABLE_PREFIX . "userfield
WHERE userid = " . $vbulletin->userinfo['userid'] . "
");
$id = $vbulletin->userinfo['userid'];
$time = time();
$sql_string = "SELECT field23
FROM " . TABLE_PREFIX . "userfieldWHERE userid = " . $vbulletin->userinfo['userid'] . "";
switch ($user['field23']) {
case "CASE1":
break;
case "CASE2":
$sql_string = "INSERT INTO vb_usergrouprequest (userid, usergroupid, reason, dateline)
VALUES ('$id','77','New Registration','$time')";
break;
case "CASE3":
$sql_string = "INSERT INTO vb_usergrouprequest (userid, usergroupid, reason, dateline)
VALUES ('$id','67','New Registration','$time')";
break;
case "CASE4":
$sql_string = "INSERT INTO vb_usergrouprequest (userid, usergroupid, reason, dateline)
VALUES ('$id','14','New Registration','$time')";
break;
case "CASE5":
$sql_string = "INSERT INTO vb_usergrouprequest (userid, usergroupid, reason, dateline)
VALUES ('$id','13','New Registration','$time')";
break;
case "CASE6":
$sql_string = "INSERT INTO vb_usergrouprequest (userid, usergroupid, reason, dateline)
VALUES ('$id','32','New Registration','$time')";
break;
}
$answer = $db->query_first($sql_string);
I can do PHP, but efficiency isn't a strong point within VB yet for me, so if anyone would like to improve the code, feel free and I'd appreciate it.
the duplicate SQL string is me after a long day just trying to make sure that SOME sql happens if none of the cases are hit, it would probably be just as good to check the sql to see if there is a string...
|