Facebook Plugin for WordPress Integration – Fix Found, and Working!

So, are you trying to integrate your WordPress with Facebook, having the latest versino of the official Facebook plugin and the latest WordPress version?

You think that it would be as simple as hitting one of the following links?

Facebook plugin login

 

As you may have already suspected… WRONG! It doesn’t have to be that simple, since Facebook is involved in the situation. And their focus on things that can’t be converted to money, on a scale of 1-10 is probably 2. Let’s say 3 if a developer is working extra-time just to fix some problems.

Anyway, I’ve clicked those links over and over again. I’ve set up my Facebook application almost perfectly, I’ve even submitted for the review for manage_pages and publish_actions

<ironic>Big suprise!!</ironic> It has been rejected!

Oh well, it’s not that i haven’t mentioned in every single textfield that I’m the only one who’s going to use their application, and that it’s destiny is to provide a nice, clear Facebook <–> WordPress integration. Nevermind!

After a couple of hours of frustration, I’ve started to dig through the code and found at an error stating that the username is sent upon authentication, and the latest version of OpenGraph v2 states that the e-mail should be sent. The problem is almost 5 months old and a GitHub issue has been created: https://github.com/facebook/wordpress/issues/533

So, long story short. Login through FTP or use the Web Hosting’s Control Panel integrated File Manager and navigate to the following path:

wp-content/plugins/facebook/admin/profile.php

Edit it and around the line 191 you should see a block that start’s with try { and ends with } catch(Exception $e) { }, just in the code below. Replace the entire block with the code provided below. Don’t worry, you can see that username has been replaced by email.

Now clicking on that stupid links should work.

Note that you don’t have to apply for a review! If the application is destined to be used just by you for integration with WordPress, you can skip this part, but be sure to check Publishing your first Open Graph action from the tutorial below to grant your application permissions!

If you think that submitting the application for a review worths the time, or you want to see how to create the Open Graph object action key pair, you can walkthrough the next part of the tutorial.

So, I’m assuming that you’ve already installed the WordPress plugin and you’ve created an Facebook application. 

Enabling the Facebook open graph features

Adding an Open Graph object action pair

  1. Open the Facebook Developers applications editor in your Web browser and select the Facebook application associated with your WordPress site to get started
  2. Select the “Open Graph” section of your application settings from the sidebar. Select “Types” from the submenu
  3. Select the “Add a New Object Type” button to associate a new Open Graph object with your Facebook application. Select “article” from the ‘typeahead’ to associate the Open Graph global article type with your Facebook application. Select “Submit” to save your object choice.
  4. Select the “Add a New Action Type” button to associate a new Open Graph action with your Facebook application. Select “publish” (News) from the ‘typeahead’ to associate the news.publishes Open Graph action with your Facebook application
  5. Select your newly selected Publish action to edit its properties. In the “Capabilities” section select the additional action capabilities built-in to the Facebook plugin for WordPress when Open Graph functionality is enabled: tags; user messages; and explicitly shared.

capabilities

 

Publishing your first Open Graph action

Test your application configuration in the Facebook Graph API Explorer by submitting a POST request for your Facebook application using your newly created news.publishes action.

Open the Facebook Graph API Explorer in a Web browser:

  • Select the Facebook application associated with your WordPress site from the drop-down list on the top right
  • Select the “Get Access Token” button to generate a new access token for your Facebook account and Facebook application.
  • Select the publish_actions or publish_stream checkbox from the User Data Permissions section. Save your selection and grant your application permission by selecting the “Get Access Token” button. The “Graph API” option should be selected below the Access Token field
  • Select POST from the drop-down menu under “Graph API” if it is not already selected (click on the link in the first step above to pre-configure this value and the next step)
  • Enter an API path of me/news.publishes to publish a new news.publishes action to your Facebook Timeline
  • Select “Add a field” to add parameters to your request. Add an article field with a URL value of a recent WordPress post on your site
  • (optional) Select “Add a field” again to add a privacy field with a value of {‘value’:’SELF’} to hide your tests from your Facebook friends
  • Submit the request. You should see a numeric identifier indicating a successful Open Graph action for your article URL
  • Visit your Facebook profile page. Select “Activity Log” button on the top right of the page to see your newly created actions

 

Submit your Open Graph action for review

Return to the Facebook application editor and select the application associated with your WordPress site. Select “Open Graph” from the sidebar, select “Types” from the submenu, and select the “Publish” action type to enter the editor used earlier. Select the “Go to Review Status” button to evaluate your application’s eligibility for Facebook Open Graph action approval. You should see an active “Submit” link under the “Action Types and Stories.”

Trigger steps

Describe the steps needed for an author on your site to publish to his or her Facebook Timeline.

If your WordPress site has not altered the default behavior of the plugin or publishing an article the default trigger flow might be described as:

Installed WordPress {version} publishing software on a web server with the Facebook plugin for WordPress {version}. An author can choose to associate a Facebook account with his WordPress account, choose to allow {site name} to publish to Facebook Timeline on his behalf, and disable posting sharing a post from the WordPress administrative interface.

  1. A WordPress author visits his WordPress profile
  2. The author chooses to grant {site name} permission to access public profile and friend list data to associate Facebook account data with his WordPress account
  3. Author optionally grants publish_actions permission for {site name} to post to his Timeline when a new post becomes public
  4. Author has chosen to display the Post to Facebook Timeline option as part of the post authoring process
  5. Author creates a new post. Post to Facebook Timeline is selected. Author publishes the story, triggering WordPress publish actions including the Facebook plugin for WordPress attempt to publish an article on behalf of the author
  6. The author’s profile page includes a link to his Facebook application permissions settings to remove permissions for {site name} to publish to his Timeline on his behalf

You should specify the version of WordPress on your server as well as the Facebook plugin for WordPress versions

Inserting Screenshots:

To be able to get you publish action approved successfully and without and rejections. Do provide Facebook team, step by step screenshots of the process that you have described above. Please Note: Though you will be asked to provide only 2 (two) screenshots of process but the form will keep giving you errors until you provide all 5 (five) screenshots they have asked for. read below which screenshots you need to provide to get the approval.

  1. 1st Screenshot: screenshot of your blog’s login page
  2. 2nd Screenshot: screenshot of your wp profile page showing your fb id associated with profile
  3.  3rd Screenshot: screenshot of your write post screen of the WP admin area
  4. 4th Screenshot: screenshot of your first public blog post whose url you provided above in Graph API explorer
  5. 5th Screenshot: screenshot of your time line activity where you received notification of publish post made by Graph API explorer

Kindly note: Use same post, for screenshots, whose URL you provided above  in Graph API explorer

Optional capabilities

The Facebook plugin for WordPress supports action capabilities allowing a custom message composed by the author, mention tagging people and pages inside a custom message, and marking an action as explicitly shared. You will need to explain your Facebook application’s use of these capabilities as part of the Open Graph action approval process.

Tags

If your WordPress site has not altered the default behavior of mention tagging used by the Facebook plugin for WordPress and has not added action tagging your site’s action flow might be described as:

An author has the ability to compose a custom message to accompany the Open Graph publish action including mentioning Facebook friends or Pages. An author may trigger a mentions search using the “@” character followed by search text. He may select a friend or page from the search results and remove friends and pages already mentioned in the custom message.

User messages

If your WordPress site has not altered the default behavior of a message composed by the author in the WordPress administrative interface’s post editor your site’s use of user messages might be described as:

An author creates a post and decides to craft a custom post summary for his Facebook Timeline audience. The author enters a summary to appear alongside the article story content in his Facebook Timeline.

Explicitly shared

If your WordPress site has not altered the default publishing preferences and opt-outs of the author publishing process your site’s use of the explicitly shared capability might be described as:

An author may choose to pre-select the Post to Facebook Timeline option by selecting the “Post an article to my Facebook Timeline after it is public” option in his WordPress Profile editor. The WordPress administrative interface’s default post editor includes a Facebook Timeline component to opt-in or opt-out of sharing an article to Facebook on a per-post basis.

Wait for your action submission approval

Your submitted action will need to be approved before stories published by your site using these actions can spread beyond the application developer’s Timeline. Facebook will notify your application’s contact email and issue a developer alert when your action is approved or more work is needed before approval.

Once your application’s action is approved you can enable Open Graph features in your WordPress administrative interface’s Facebook Social Publisher Settings to take advantage of Open Graph features and publish actions.

A successfully configured Facebook application with an approved Publish action compatible with the Facebook plugin for WordPress will display an approval message similar to the screenshot below. Once your application is approved and out of sandbox mode you may enable Open Graph features in your WordPress administrative interface’s Facebook Social Publisher Settings screen.

fb_approval_status

 

So, enjoy the customised publish action with your WordPress Blog. I hope the article was helpful for you all. Feel free to ask me any related questions. i would be glad to help. Thank you for dropping in and reading the article.

  • Greg

    Hi,

    I have tried to change with your code provide but this is generating an error in my Website.

    I think you have an error with the “‘fb_uid’ =&gt”

    I see in the original one “=> ”

    Kind Regards,

    Greg

    • Greg

      In original:

      $facebook_user_data = array(
      ‘fb_uid’ => $facebook_user[‘id’],
      ‘activation_time’ => time()
      );

      Your code:

      $facebook_user_data = array(
      ‘fb_uid’ => $facebook_user[‘id’],
      ‘activation_time’ => time()
      );

  • Greg

    sorry your code:

    $facebook_user_data = array(
    ‘fb_uid’ => $facebook_user[‘id’],
    ‘activation_time’ => time()
    );

  • Greg

    Ok I think I understand :) there is a pb in conversion with your website :) => is replace by =&gt :)

    • Yeah, thank you Greg for your observation! I’ve fixed the problem now.

      Hope that the Facebook association worked!

  • Dirk

    I tried this and I do see the “Allow new posts to facbook page” link. When I click the link I can grant the app permission and then the wordpress admin page is refreshed I still have the same link “Allow new posts to Facebook page” and I can not choose a page to post to.

    • This is odd. Can you double-check that you’ve given the application the proper permissions for posting to pages?

  • DWGreen

    I tried fiddling with this for a couple of hours. I was able to get the same result using Jetpack plugin,

  • Joris

    Parse error: syntax error, unexpected ‘=’, expecting ‘)’ in /home/frivbest/public_html/wp-content/plugins/facebook/admin/profile.php on line 191

    get this message and i exactly copy pasted it??