/**
  * loadCustomer() method load customer in PS
  *
  * @param numeric $nSocialId
  */
 protected function loadCustomer($nSocialId)
 {
     // get customer ID
     $iCustomerId = self::getCustomerId($nSocialId);
     // auth customer
     $oCustomer = new Customer($iCustomerId);
     // is valid customer
     if (Validate::isLoadedObject($oCustomer)) {
         if (version_compare(_PS_VERSION_, '1.5', '>')) {
             Context::getContext()->cookie->id_customer = intval($oCustomer->id);
             Context::getContext()->cookie->customer_lastname = $oCustomer->lastname;
             Context::getContext()->cookie->customer_firstname = $oCustomer->firstname;
             Context::getContext()->cookie->logged = 1;
             Context::getContext()->cookie->passwd = $oCustomer->passwd;
             Context::getContext()->cookie->email = $oCustomer->email;
             //                Context::getContext()->cookie->is_guest = !Tools::getValue('is_new_customer', 1);
             Context::getContext()->customer->logged = 1;
             if (Configuration::get('PS_CART_FOLLOWING') && (empty(Context::getContext()->cookie->id_cart) || Cart::getNbProducts(Context::getContext()->cookie->id_cart) == 0)) {
                 Context::getContext()->cookie->id_cart = intval(Cart::lastNoneOrderedCart($oCustomer->id));
             }
             Hook::Exec('authentication');
         } else {
             global $cookie;
             $cookie->id_customer = intval($oCustomer->id);
             $cookie->customer_lastname = $oCustomer->lastname;
             $cookie->customer_firstname = $oCustomer->firstname;
             $cookie->logged = 1;
             $cookie->passwd = $oCustomer->passwd;
             $cookie->email = $oCustomer->email;
             //                $cookie->is_guest = !Tools::getValue('is_new_customer', 1);
             $oCustomer->logged = 1;
             if (Configuration::get('PS_CART_FOLLOWING') && (empty($cookie->id_cart) || Cart::getNbProducts($cookie->id_cart) == 0)) {
                 $cookie->id_cart = intval(Cart::lastNoneOrderedCart($oCustomer->id));
             }
             Module::HookExec('authentication');
         }
     } else {
         throw new BT_ConnectorException(FacebookPsConnect::$oModule->l('Internal server error => authentication failed', 'base-connector_class'), 531);
     }
 }