Title: Front-End Implementation?
Last modified: August 21, 2016

---

# Front-End Implementation?

 *  [coreymcollins](https://wordpress.org/support/users/coreymcollins/)
 * (@coreymcollins)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/front-end-implementation/)
 * Is there any kind of front-end implementation for the “Allow new posts to your
   Facebook Timeline” functionality? Everything else I’m doing keeps the user out
   of the backend (login, logout, profile edit, etc.), and I’d love to keep in line
   with that with this plugin.
 * I don’t see anything in the settings, but is there any recommendation for how
   to implement this manually?
 * I found the div that appears to be doing the work:
 * `<div class="facebook-login" data-scope="person">Allow new posts to your Facebook
   Timeline</div>`
 * And copied the login.js file from the plugin to my theme’s JS directory, enqueueing
   it when needed. The JS file loads, but when the link is clicked I receive a “
   FB is not defined” error on line 51. I’m assuming that this is because another
   part of the plugin is not being integrated.
 * Any thoughts on this? Thanks!
 * [http://wordpress.org/extend/plugins/facebook/](http://wordpress.org/extend/plugins/facebook/)

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [Niall Kennedy](https://wordpress.org/support/users/niallkennedy/)
 * (@niallkennedy)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/front-end-implementation/#post-3871851)
 * I’m currently working on some better author login flows for the user profile 
   pages but the logic is essentially the same.
 * If you are building a custom front-end you will need to first load the Facebook
   SDK for JavaScript (that `FB` variable you’re missing):
    1. The JavaScript file is [registered with the facebook-jssdk handle](http://plugins.trac.wordpress.org/browser/facebook/tags/1.4/facebook.php#L123)
       and enqueued when used in the plugin (or your own code)
    2. The asynchronously loaded Facebook SDK for JavaScript executes the `fbAsyncInit`
       function when it’s ready to start accepting bindings or code that depends on
       the existence of the JavaScript SDK. You can queue a function to be executed
       at or after this function happens using the JavaScript function `FB_WP.queue.
       add` ([see Google Analytics add-on for an example](http://plugins.trac.wordpress.org/browser/facebook/tags/1.4/extras/google-analytics.php)).
       You can also add JavaScript code to be executed in the `facebook_jssdk_init_extras`
       filter
 * Then you’re looking at associating the Facebook account of the current viewer
   with their WordPress user account. The plugin stores data about the Facebook 
   user account in the `fb_data` user meta field. The fields stored can change in
   different versions of the plugin; you can see the current values [in admin/login.php](http://plugins.trac.wordpress.org/browser/facebook/tags/1.4/admin/login.php#L73).
 * Time to prompt an author for permission to access his Facebook account and optionally
   post to Facebook Timeline on his behalf. You’ll need:
    1. JavaScript code calling [FB.login](https://developers.facebook.com/docs/reference/javascript/FB.login/)
       with no scope of you just want to associate an account (e.g. for identifying
       an author) or a `publish_actions` scope if you want to be able to publish to
       Facebook on behalf of the author.
    2. Check for a successful state in the callback, then write the user meta values

Viewing 1 replies (of 1 total)

The topic ‘Front-End Implementation?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/facebook_526fac.svg)
 * [Facebook](https://wordpress.org/plugins/facebook/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/facebook/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/facebook/)
 * [Active Topics](https://wordpress.org/support/plugin/facebook/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/facebook/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/facebook/reviews/)

## Tags

 * [front-end](https://wordpress.org/support/topic-tag/front-end/)
 * [frontend](https://wordpress.org/support/topic-tag/frontend/)

 * 1 reply
 * 2 participants
 * Last reply from: [Niall Kennedy](https://wordpress.org/support/users/niallkennedy/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/front-end-implementation/#post-3871851)
 * Status: not resolved