Difference between revisions of "Facebook"

From Organic Design wiki
(Embedding the wiki in the Facebook Canvas: must be an HTTPS connection, but a self-signed certificate is accepted)
m
Line 1: Line 1:
I'm doing a job that requires a MediaWiki to post recentchanges to facebook wall. I started with [http://nocturnsoft.com/devblog/?p=1745 wall posts with the facebook PHP SDK], which I got working ok, except for one difference which is that the siteURL is now set from the "website" section of "Select how your app integrates with Facebook" in the "edit App" screen.
+
I'm doing a job that requires a MediaWiki to post recentchanges to user's facebook wall, and to be embedded in the Facebook canvas.
 
 
Here's the post that my test script did:
 
 
 
{| style="margin-left:50px;border: 1px solid #ccc"
 
|-
 
|[[File:Facebook-wall-post.png]]
 
|}
 
  
 
== Logging in to the wiki with Facebook account ==
 
== Logging in to the wiki with Facebook account ==
Line 22: Line 15:
  
 
== Posting wiki changes to the users wall ==
 
== Posting wiki changes to the users wall ==
 +
I started with [http://nocturnsoft.com/devblog/?p=1745 wall posts with the facebook PHP SDK], which I got working ok, except for one difference which is that the siteURL is now set from the "website" section of "Select how your app integrates with Facebook" in the "edit App" screen.
 +
 +
Here's the post that my test script did:
 +
{| style="margin-left:50px;border: 1px solid #ccc"
 +
|-
 +
|[[File:Facebook-wall-post.png]]
 +
|}
 +
 
I got that working with the following settings:
 
I got that working with the following settings:
 
{{code|<php>
 
{{code|<php>

Revision as of 08:39, 6 October 2011

I'm doing a job that requires a MediaWiki to post recentchanges to user's facebook wall, and to be embedded in the Facebook canvas.

Logging in to the wiki with Facebook account

In installed the facebook extension so that users can use their Facebook account to login to the wiki. This requires some database tables to be set up first by running the update.php maintenance script.

  • The Facebook SQL filenames needed to be prepending with the database table prefix before running the maintenance script.
  • I had to make all the permissions on the wiki open so that the extension could create an account.
FacebookLoggedIn.png
  • See info about the extension configuration here.
  • Sometimes during testing and deleting apps and users etc, a user becomes corrupted and can't login properly anymore. To fix this, delete everything in the Facebook database table with delete * from wiki_user_fbconnect;

Posting wiki changes to the users wall

I started with wall posts with the facebook PHP SDK, which I got working ok, except for one difference which is that the siteURL is now set from the "website" section of "Select how your app integrates with Facebook" in the "edit App" screen.

Here's the post that my test script did:

Facebook-wall-post.png

I got that working with the following settings:

{{{1}}}

But there seems to be something wrong with the preferences and I had to comment out a condition in FacebookPushEvent.php on line 169:

<php>
   if( !$wgUser->getOption( self::$PREF_TO_DISABLE_ALL ) ) {

// if( $wgUser->getOption( $prefName ) ) {

           $pushObj->init();

// }

   }

</php>

Further investigation shows that the problem is due to the up_properties field of the user_properties table is of type varbinary(32) so is truncated to 32 characters.

Embedding the wiki in the Facebook Canvas

I've got the wiki to embed in the canvas using the Facebook application settings shown below, but for some reason many of the links such as RecentChanges or editing a page return a blank screen while others work ok. Since October 1st the embedded application must be an HTTPS connection, but a self-signed certificate is accepted so this is not a big problem.

Facebook-app-settings.png

Mediawiki-in-facebook-canvas.jpg

Logging in with Facebook groups