/**
 * Smarty plugin
 * -------------------------------------------------------------
 * File: insert.oxid_newbasketitem.php
 * Type: string, html
 * Name: newbasketitem
 * Purpose: Used for tracking in econda, etracker etc.
 * -------------------------------------------------------------
 *
 * @param array  $params  params
 * @param Smarty &$smarty clever simulation of a method
 *
 * @return string
 */
function smarty_insert_oxid_fblogin($params, &$smarty)
{
    $myConfig = oxConfig::getInstance();
    $oView = $myConfig->getActiveView();
    if (!$myConfig->getConfigParam("bl_showFbConnect")) {
        return;
    }
    // user logged in using facebook account so showing additional
    // popup about connecting facebook user id to existing shop account
    $oFb = oxFb::getInstance();
    if ($oFb->isConnected() && $oFb->getUser()) {
        //name of template
        $sTemplate = 'inc/popup_fblogin.tpl';
        // checking, if Facebeook User Id was successfully added
        if (oxSession::getVar('_blFbUserIdUpdated')) {
            $sTemplate = 'inc/popup_fblogin_msg.tpl';
            oxSession::deleteVar('_blFbUserIdUpdated');
        }
        return $smarty->fetch($sTemplate);
    }
}
 /**
  * Updates user Facebook ID
  *
  * @return null
  */
 public function updateFbId()
 {
     $oFb = oxFb::getInstance();
     $blRet = false;
     if ($oFb->isConnected() && $oFb->getUser()) {
         $this->oxuser__oxfbid = new oxField($oFb->getUser());
         $blRet = $this->save();
     }
     return $blRet;
 }
 /**
  * Gets get Facebook user id
  *
  * @return int
  */
 public function getFbUserId()
 {
     if ($this->getConfig()->getConfigParam("bl_showFbConnect")) {
         $oFb = oxFb::getInstance();
         return $oFb->getUser();
     }
 }
Beispiel #4
0
 /**
  * Fills user form with date taken from Facebook
  *
  * @return null
  */
 protected function _fillFormWithFacebookData()
 {
     // Create our Application instance.
     $oFacebook = oxFb::getInstance();
     if ($oFacebook->isConnected()) {
         $aMe = $oFacebook->api('/me');
         $aInvAdr = $this->getInvoiceAddress();
         $sCharset = oxLang::getInstance()->translateString("charset");
         // do not stop converting on error - just try to translit unknown symbols
         $sCharset .= '//TRANSLIT';
         if (!$aInvAdr["oxuser__oxfname"]) {
             $aInvAdr["oxuser__oxfname"] = iconv('UTF-8', $sCharset, $aMe["first_name"]);
         }
         if (!$aInvAdr["oxuser__oxlname"]) {
             $aInvAdr["oxuser__oxlname"] = iconv('UTF-8', $sCharset, $aMe["last_name"]);
         }
         $this->setInvoiceAddress($aInvAdr);
     }
 }