예제 #1
0
 // Came from our reg page
 if ($mybb->request_method == "post") {
     $newuser = array();
     $newuser['name'] = $mybb->input['username'];
     $newuser['email'] = $mybb->input['email'];
     $settingsToAdd = array();
     $settingsToCheck = array("twavatar", "twbio", "twlocation");
     foreach ($settingsToCheck as $setting) {
         if ($mybb->input[$setting] == 1) {
             $settingsToAdd[$setting] = 1;
         } else {
             $settingsToAdd[$setting] = 0;
         }
     }
     // Register him
     $user = $TwitterConnect->register($newuser);
     // Insert options and extra data and login
     if (!$user['error']) {
         $db->update_query('users', $settingsToAdd, 'uid = ' . (int) $user['uid']);
         // Sync
         $newUser = array_merge($user, $settingsToAdd);
         $TwitterConnect->sync($newUser);
         // Login
         $TwitterConnect->login($user);
         // Redirect
         $TwitterConnect->redirect($mybb->input['redUrl'], $lang->sprintf($lang->mytwconnect_redirect_title, $user['username']), $lang->mytwconnect_redirect_registered);
     } else {
         $errors = inline_error($user['error']);
     }
 }
 $options = '';