NUKE 6.5 ONLY!!
IN order to use the User or Admin activation setting if you are using your Forums as your means of letting your users register, then there is one thing you need to do in order for your Users to NOT be able to loggin to Nuke until they click the Activation link that was sent to them by the Forum activation. Or if you have this setting at Admin Activation, then the user will NOT be able to loggin until YOU the ADMIN activate them by clicking the link in the email YOU were sent.
Without this little fix, by Maty of
http://www.matyscripts.com
the user would be able to loggin to Nuke without activating themselves, but they would NOT be logged into the forum 8O . SO, what we needed to do was make the Nuke loggin feature LOOK at the user_active field in the users table of the database and check the value. If the user is not activated, value=0 then it won't let them loggin. IF it is 1, then they will be able to loggin. This value in the database doesn't change until the user or admin activates the registered user.
Ok after all that typing, here it is.
You need to replace the entire function login in the
modules/Your Account/index.php file with this:
Code:
function login($username, $user_password, $redirect, $mode, $f, $t, $random_num, $gfx_check) {
global $setinfo, $user_prefix, $db, $module_name, $pm_login, $prefix;
include("config.php");
$sql = "SELECT user_password, user_id, storynum, umode, uorder, thold, noscore, ublockon, theme, commentmax, user_active FROM ".$user_prefix."_users WHERE username='$username'";
$result = $db->sql_query($sql);
$setinfo = $db->sql_fetchrow($result);
$forward = ereg_replace("redirect=", "", "$redirect");
if (ereg("privmsg", $forward)) {
$pm_login = "active";
}
if (($db->sql_numrows($result)==1) AND ($setinfo[user_id] != 1) AND ($setinfo[user_password] != "") AND ($setinfo[user_active] == 1 )) {
$dbpass=$setinfo[user_password];
$non_crypt_pass = $user_password;
$old_crypt_pass = crypt($user_password,substr($dbpass,0,2));
$new_pass = md5($user_password);
if (($dbpass == $non_crypt_pass) OR ($dbpass == $old_crypt_pass)) {
$db->sql_query("UPDATE ".$user_prefix."_users SET user_password='$new_pass' WHERE username='$username'");
$sql = "SELECT user_password FROM ".$user_prefix."_users WHERE username='$username'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$dbpass = $row[user_password];
}
if ($dbpass != $new_pass) {
Header("Location: modules.php?name=$module_name&stop=1");
return;
}
$datekey = date("F j");
$rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . $sitekey . $random_num . $datekey));
$code = substr($rcode, 2, 6);
if (extension_loaded("gd") AND $code != $gfx_check) {
Header("Location: modules.php?name=$module_name&stop=1");
die();
} else {
docookie($setinfo[user_id], $username, $new_pass, $setinfo[storynum], $setinfo[umode], $setinfo[uorder], $setinfo[thold], $setinfo[noscore], $setinfo[ublockon], $setinfo[theme], $setinfo[commentmax]);
$uname = $_SERVER["REMOTE_ADDR"];
$db->sql_query("DELETE FROM ".$prefix."_session WHERE uname='$uname' AND guest='1'");
}
if ($pm_login != "") {
Header("Location: modules.php?name=Private_Messages&file=index&folder=inbox");
exit;
}
if ($redirect == "" ) {
Header("Location: modules.php?name=Your_Account&op=userinfo&bypass=1&username=$username");
} else if ($mode == "") {
Header("Location: modules.php?name=Forums&file=$forward");
} else if ($t !="") {
Header("Location: modules.php?name=Forums&file=$forward&mode=$mode&t=$t");
} else {
Header("Location: modules.php?name=Forums&file=$forward&mode=$mode&f=$f");
}
} else {
Header("Location: modules.php?name=$module_name&stop=1");
}
}
Now one more thing.
The link it sends in the Email from the Forum registration to activate may be wrong. If it gives you an error when you click the link, do the following.
manually edit the lines in the
includes/usercp_register.php
change this
Code:
'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' .
to this
Code:
'U_ACTIVATE' => $server_url . '&mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' .
there are 3 lines exactly like that in that file.
mikem