here is the code:
function wp_login($username, $password, $already_md5 = false) {
global $wpdb, $error;
if ( '' == $username )
return false;
if ( '' == $password ) {
$error = __('<strong>Error</strong>: The password field is empty.');
return false;
}
$auth = true;#ldap_auth($username, $password);
$login = get_userdatabylogin($username);
#
if($auth and $login){
#print "return true r2";
return true;
}
if(! $auth and $login){
if($login->user_pass==$password){
#print "return true r1";
return true;
}
$error = __('<strong>Error</strong>: Login error.');
return false;
}
# if auth is true but login is false, make new user
if($auth and ! $login){
if(! function_exists("wp_create_user"))print "before";
$userid = 23 ;#wp_create_user($username, $password, $username."@njit.edu");
#print "created new user";
$login = get_userdata($userid);
print_r($login);
if(! $login) {
#print "error getting info from new user";
$error = __("error getting info from new user");
return false;
}
else{
return true;
}
}
return false;
}