Hi guys! Im trying to build a facebook login button.So far i built the script to get permission and all details about a user.In the file register.php i put an if statement like this:
Now if i have all details(name, password, email, avatar) how can i create a new user and authenticate him when $fblogin = true?Code:if ($fblogin = true ) { run the script }
In the file register.php i found this function but i dont know how to change it so i can use it for this.
Thank you!Code:function register_add_user($username, $email, $password, $password2){ global $current_user; $user = new User(); $user->username = $username; $user->pass = $password; $user->email = $email; if($user->Create()){ $user->read('short'); $registration_details = array( 'username' => $username, 'password' => $password, 'email' => $email, 'id' => $user->id ); check_actions('register_success_pre_redirect', $registration_details); $current_user->Authenticate($username, $password, false); if ($registration_details['redirect']) header('Location: '.$registration_details['redirect']); elseif(pligg_validate()){ header('Location: '.my_base_url.my_pligg_base.'/register_complete.php?user='.$username); } else { header('Location: ' . getmyurl('user', $username)); } die(); } }



Reply With Quote




