} else {
     //no local copy of this profile yet
     $mail = $user_profile->email;
     $create_account = true;
     if ($mail == null) {
         $mail = '';
     } else {
         //we got an email, lets check if it exists
         $qry = "SELECT id FROM " . PREFIX . "codo_users WHERE mail=:mail";
         $stmt = $this->db->prepare($qry);
         $stmt->execute(array(":mail" => $mail));
         $res = $stmt->fetch();
         if (!empty($res)) {
             //looks like this user has already registered
             $create_account = false;
             CODOF\User\User::login($res['id']);
             //now this will work if you change authentication from
             //fb to gmail etc
         }
     }
     if ($create_account) {
         $reg = new CODOF\User\Register($db);
         $reg->mail = $mail;
         $reg->name = $user_profile->firstName . ' ' . $user_profile->lastName;
         $reg->oauth_id = $oauth_id;
         $reg->username = $username;
         $reg->avatar = $user_profile->photoURL;
         $reg->user_status = 1;
         //approved user
         $reg->register_user();
         $reg->login();