[extension] faceplugs

That’s really strange I have similar code and it will at least open up a popup window allowing login.




<?php $this->widget('ext.faceplugs.LoginButton'); ?>



Though passing the URL won’t hurt, it’s simply not used by the plugin.

Depending on app settings the originating page URL may not be valid but this should not stop it from allowing the user to log in.

Maybe there is something wrong with the code being generated, can you post the HTML / JS on the page ?

Mine looks like this :




<div id="fb-root"></div><fb:login-button></fb:login-button>


....


<script type="text/javascript">

/*<![CDATA[*/

window.fbAsyncInit = function(){FB.init({'status':true,'cookie':true,'xfbml':true,'appId':'xxxxxxxxxx'});};

				(function(){

				var e=document.createElement('script');

				e.async=true;

				e.src='http://connect.facebook.net/en_US/all.js';

				document.getElementById('fb-root').appendChild(e);}());

/*]]>*/

</script>



I dont have any of that code showing at all. I downloaded the latest version update where you have a text error message in in the case of no app_id and found that was coming up.

In head, when relying on Param fbAppId


<meta property="og:app_id" />

button code showing after I declare app_id locally


<fb:login-button></fb:login-button>

I inserted the app_id into the widget and the error went away, but still the button is not clickable and I dont see the js call that you have here.

I have the fbAppId set in my parameters correctly, but I notice in the EFaceplugsBase.php file that the registerOpenGraph function is called in init() on line 244 before the $this->app_id has a chance to be checked for local declaration as app_id from the widget, or if not getting fbAppId from the parameter. This is happening inside run() on line 275 after the init() has been called.


'params'=>array(				

      'fbAppId' => 'XXXXXXXXXXX',

)

So the registerOpenGraph() which makes the meta tag for app_id is called before the parameter value is passed in.

Is this correct ?

Hi ianare! Hi Gustavo!

Has any relation to the famous facebook.php with your extension.

How can I use it with db?

Where can I take user_id(from facebook to make my own userId) with your extension?

Which one have to I use <iframe> or js sdk?

What are difference of them?

Please, make me clear these!!!

Thanks!

Hi Juma

The extension is just a PHP wrapper for all facebook plugins

It uses JS SDK, and SDK creates an iframe

more about the js sdk here http://developers.fa…nce/javascript/

the app_id you must get from http://www.facebook.com/developers/

a complete documentation of each plugin can be found here http://developers.fa…m/docs/plugins/

after you get an Id you can use all plugins, including the registration one that you are more interested

To use it with DB (I suppose you mean use registration plugin and save data to db), you must define a ‘redirect_uri’ and this url defined will receive json response from facebook, to save in db just json_decode the response and save in the database

more about the registration plugin and response here http://developers.fa…s/registration/

I think that will clarify things a bit for you

thanks, Gustavo!

Sorry for taking so long to respond. A new version has been released which should fix this bug. Let me know :wink:

Hey guys, I’m sorry, but I just can’t get this extension to work and can’t figure out what the problem is.

I always get this error code:


CException


Objekt-Konfiguration muss ein Array sein, das ein "class"-Element beinhaltet.


C:\xampp\htdocs\test\protected\extensions\faceplugs\EFaceplugsBase.php(265)


253         if ($this->app_id) {

254             $this->registerOpenGraph('app_id', $this->app_id);

255         }

256 

257         foreach ($this->og as $type => $value) {

258             $this->registerOpenGraph($type, $value);

259         }

260     }

261 

262     public function run()

263     {

264         //run only once

265         if (!isset(Yii::app()->params->fbRootSet)) {

266             if ($this->debugMode === 'auto' && YII_DEBUG === true) {

267                 $this->debugMode = 'on';

268             }

269             if ($this->debugMode === 'on') {

270                 $this->scriptFile = 'static.ak.fbcdn.net/connect/en_US/core.debug.js';

271             }

272             else {

273                 $this->setScriptLocale();

274             }

275 

276             $protocol = 'http';

277             if (isset($_SERVER['HTTPS'])) {

I put the AppId in the config and in the view it looks like this:


$og = array(

    'title' => $model->translations[0]->title,

    'site_name' => 'Test',

    'description' => $model->translations[0]->description,

    'type' => 'website',

);


$this->widget('ext.faceplugs.LikeButton', array(

    'url' => $this->createAbsoluteUrl('/'),

    'og' => $og,

    'layout' => 'button_count',

    'action' => 'recommend',

    'colorscheme' => 'dark',

));

If I create a Like button directly I can get it to work … anyone got an idea for this issue? would be awesome!

hey

this looks like a bug to me

try to change the line 265 from


if (!isset(Yii::app()->params->fbRootSet)) {

to


if (!isset(Yii::app()->params['fbRootSet'])) {

or there is some error in your params config

There seems to be some reoccuring problems with the app_id … I will be updating the extension to use a better system soon.

Thanks for your replies. My params are just a normal array, and I never had problems with it, so I guess they are in good shape :stuck_out_tongue: … the only option I have to add to the params is “fbAppId”, is this correct? Or what is about the ‘fbRootSet’?

@Gustavo: I changed the line as you said, but it just pops up the next error:


CException


Objekt-Konfiguration muss ein Array sein, das ein "class"-Element beinhaltet.


C:\xampp\htdocs\startregie\protected\extensions\faceplugs\EFaceplugsBase.php(247)


235         'qu_PE',

236         'ay_BO',

237         'se_NO',

238         'ps_AF',

239         'tl_ST',

240     );

241 

242     public function init()

243     {

244         if (property_exists($this, 'href') && $this->href === null) {

245             $this->href = $this->url;

246         }

247         if (!$this->app_id && isset(Yii::app()->params->fbAppId)) {

248             $this->app_id = Yii::app()->params->fbAppId;

249         }

250         if ($this->url) {

251             $this->registerOpenGraph('url', $this->url);

252         }

253         if ($this->app_id) {

254             $this->registerOpenGraph('app_id', $this->app_id);

255         }

256 

257         foreach ($this->og as $type => $value) {

258             $this->registerOpenGraph($type, $value);

259         }




after trying to change this as well it says:




CException


Objekt-Konfiguration muss ein Array sein, das ein "class"-Element beinhaltet.


C:\xampp\htdocs\startregie\protected\extensions\faceplugs\EFaceplugsBase.php(247)


235         'qu_PE',

236         'ay_BO',

237         'se_NO',

238         'ps_AF',

239         'tl_ST',

240     );

241 

242     public function init()

243     {

244         if (property_exists($this, 'href') && $this->href === null) {

245             $this->href = $this->url;

246         }

247         if (!$this->app_id && isset(Yii::app()->params['fbAppId'])) {

248             $this->app_id = Yii::app()->params['fbAppId'];

249         }

250         if ($this->url) {

251             $this->registerOpenGraph('url', $this->url);

252         }

253         if ($this->app_id) {

254             $this->registerOpenGraph('app_id', $this->app_id);

255         }

256 

257         foreach ($this->og as $type => $value) {

258             $this->registerOpenGraph($type, $value);

259         }

So it always says something like: The object configuration must be an array containing a "class"-element.

Any other ideas? :wink:

here’s some part of my params:

main.php:


'params' => require(dirname(__FILE__) . '/params.php'),

params.php:


// this contains the application parameters that can be maintained via GUI

return array(

    // this is displayed in the header section

    'title' => 'Test',

    // this is used in error pages

    'adminEmail' => 'xxx@xx.xx',

    // number of posts displayed per page

    'postsPerPage' => 10,

    // maximum number of comments that can be displayed in recent comments portlet

    'recentCommentCount' => 10,

    // maximum number of tags that can be displayed in tag cloud portlet

    'tagCloudCount' => 20,

    // whether post comments need to be approved before published

    'commentNeedApproval' => true,

    // the copyright information displayed in the footer section

    'copyrightInfo' => 'Copyright &copy; 2009 by Yii.',

    // Facebook App ID

    'fbAppId' => 'xxxxxxxxxxxxxxx',

);



Thanks a lot so far!

Try changing this to :




    // Facebook App ID

    'app_id' => 'xxxxxxxxxxxxxxx',



I tried this, but still the same error like above. Weird stuff … is it just me, who has this bug? … I’m really gettin nervous :stuck_out_tongue:

Hm not sure … but I don’t think keeping all parameters for different things like that is a good idea. Why not use the Yii config file ?

Anyway I’m looking into another way of setting the app_id as there have been problems with it in the past, but I’m not sure it will help your particular (non standard) usage case.

Can you please briefly describe how to use this extension? I am not sure about where to put all those files…

Faceplugs … giggles :lol:

Can you extend CComponent to have this stuff.

I got the same problem but … I am already logged in on facebook. Try to logout your account and then retry this extension! I’d tried to use firebug and I see a javascript error on javascript console:

Guys I am using the faceplugs extension. I get the like button to display and when the user clicks on the like button everything works fine. However,I don’t see any notification that I liked something on my facebook profile. Is this normal?

If not what do I need to do so that I also see a notification on facebook.com

One important thing. My like button is linked to every new post in my blog. For example if I write a blog post about Yii. This post would have its individual like button.

faceplugs using to perform the test on me generate error, this is generated: Errors That Must Be Fixed

Circular Path Redirect: Circular redirect path detected (see ‘Redirect Path’ section for details).