Hi,
While this might be not necessary for everyone, it would be nice to have this option in the GUI as well.

It is important for Facebook Autopost integration as asking for user permission on the fly when submitting a comment for example, surprised the user when he is not ready for that massage.

I found the approach of asking for this permission during the registration more robust.

While there are so many other extended permission in the GUI right now and many of them irrelevant or rarely used - this one is really needed. it would be nice to have!

BR
Itzhak

Comments

nit3ch’s picture

hi,
Can you tell me how to give my app permission to "Post on user behalf". Whenever user try to connect to through fb acconnt , the permission to "Post on user behalf" is missing. i being the creator of the app able to post on fb but other user who are connect their fb account are not able to post.
Thanks in advance. :)

hyperlinked’s picture

Issue summary: View changes

I agree that this is something that would be very desirable to have in place, but I can understand why it was left out as Facebook's best practices say to not ask for permission to post on their behalf until right before they're about to post something.

It's actually pretty easy to modify the FB Connect buttons using hook_fboauth_actions() so that your authentication request is initiated with additional scopes.

You can add the following code to a custom module to extend the regular connect action to include additional scopes:

function mymodule_fboauth_actions() {
// This is basically a straight copy of the original connect action.
$actions['mymodule_connect'] = array(
    'title' => t('Connect'),
    'file' => drupal_get_path('module','fboauth').'/includes/fboauth.fboauth.inc',
    'callback' => 'fboauth_action_connect',
    'permissions' => array_keys(fboauth_user_connect_permissions())
);

// I'm adding additional scope parameters to the original action here.
$actions['mymodule_connect']['permissions'] = array('publish_pages','publish_actions');

Then in the theme function where the buttons are rendered you look for this:

fboauth_action_display('connect');

Replace it with a call to your extended version of the original connect action.

fboauth_action_display('mymodule_connect');
AlexKirienko’s picture

Version: 7.x-1.6 » 7.x-2.x-dev
Status: Active » Needs review

Asking permissions when you need it is a good practice. But didn't tests how it works yet. @hyperlinked thank you for example, I will try it.

I think this is one of core new practice in v2.x Graph API. It need to be described in readme and help pages.

jamesdixon’s picture

The @hyperlinked method worked for me, but I changed the code to the following:

 $actions['mymodule_connect'] = array(
    'title' => t('Connect'),
    'file' => drupal_get_path('module','fboauth').'/includes/fboauth.fboauth.inc',
    'callback' => 'fboauth_action_connect',
    'permissions' => array_keys(fboauth_user_connect_permissions())
  );  
  // Adding additional scope parameters to the original action here
  $actions['mymodule_connect']['permissions'][] = 'publish_pages';
  $actions['mymodule_connect']['permissions'][] = 'publish_actions';

Otherwise the permissions in:

array_keys(fboauth_user_connect_permissions())

get overwritten.

Also a heads up you'll run into this issue unless Facebook reviews your app and approves the publish_pages and publish_actions permissions:

http://www.scriptscoop2.com/t/528cd23d0127/facebook-how-to-post-to-my-ow...