Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter preetisblog

    (@preetisblog)

    Yeah you are right Niall, checking Facebook_Loader first will be in order. Can u explain to me how I can force my code to run after the plugin has done its job?

    Thread Starter preetisblog

    (@preetisblog)

    Thanks Niall for that input.

    Thus could finally figure out the correct way to use global $facebook post these updates is as shown by the following code:

    global $facebook;
    if (! ( isset($facebook) ))
    {
       global $facebook_loader;
       if(!(isset($facebook_loader)))
       {
         $facebook_loader = new Facebook_Loader();
       }
      if (! ( isset($facebook) ))
       {
        $facebook_loader->load_php_sdk();
       }
    }
    if ( isset($facebook) )
    { ... do whatever you want with $facebook after this....

    may be becoz the load_php_sdk function is inside Facebook_Loader class. May be if my approach is correct, we can get it documented in the plugin for correct usage by everyone…

    Changing the status to resolved, as no changes required in plugin except for the documentation part…

    Regards

    Thread Starter preetisblog

    (@preetisblog)

    Thanks for a prompt reply…

    Yeah it was all fine till recent spate of updates from Facebook Social Plugin, which is leaving a bad taste. I also use similar code at various places on my site. Take for example the following piece of code:

    global $facebook;
    if ( isset($facebook) )
    {
    //$url = get_permalink($post->ID);
    
    $newurl='http://preetisblog.com/programming/display-combined-comments-count-of-facebook-and-wordpress-comments-on-blog/';
    $myuser_profile = $facebook->api('/?ids='.$newurl,'GET');
           // echo "Shares: " . $myuser_profile[$newurl]['shares']."\n";
    //echo "Comments: " . $myuser_profile[$newurl]['comments']."\n";
    $fbcount=$myuser_profile[$newurl]['comments'];
    echo "count=$fbcount";
    }
    else
    {
    echo "no facebook";
    }

    This works well at a normal php page like here, which does not has facebook plugin installed.

    But does not works here (see on righthand side-bar bottom), where you see “no facebook” text. Further if i try to declare global $facebook as per php sdk by using configuration values again, it results in failure of all facebook plugin components on site like the comments box, subscribe button, like button etc..

    Thus m not able to make any api calls via php sdk…

Viewing 3 replies - 1 through 3 (of 3 total)