comments trigger update status

psi-borg - August 25, 2009 - 19:46
Project:Drupal for Facebook
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

it looks like only the single line and short story feeds are supported for publishing actions. did i miss the action for updating a user's status?

for example, i'd like to have comments get published to a user's update status, rather than a one liner (publish dialog seems redundant for a comment).

i guess more generally, what would be the proper way to extend dff publishing actions for other contributed modules (like voting api), based on triggering event? maybe transform the fb_feed.module such that it can be called by other modules to publish one liners, short stories or to a user's status? i searched for status_set() in fb_feed.module, not sure where else it would be...

i'd be happy to contribute any code i'm lucky enough to get working if shown the right way to do it.

#1

Dave Cohen - August 26, 2009 - 06:32
Category:support request» feature request

There's no action to do this right now, but I'm in favor of adding it. Want to take a stab at it?

The options are to either create a new module, say fb_status.module (or fb_stream.module using the newer stream api). Or add to fb_actions.module. fb_actions.module was originally intended to be a place for such things, but as the fb_feed support got more complicated I moved the feed-related actions there.

The module should also prompt for the set status extended permission, or work with the fb_perms module to do so.

Or just write a custom module handling your specific case. I.e. implementing a votingapi hook and calling facebook api from there. Sometimes its better to do that instead of trying to add this to Drupal for Facebook in a generic way. know what I mean?

#2

psi-borg - August 27, 2009 - 09:39

"There's no action to do this right now, but I'm in favor of adding it. Want to take a stab at it?"
haha sure dave if you want dff turned into a bloody pulp.

"The module should also prompt for the set status extended permission, or work with the fb_perms module to do so."
what are the extended permissions checkboxes for the fb application content type for? i have the extended permission checked for status_update, yet i get Error 250, Updating status requires the extended permission status_update.

"Or just write a custom module handling your specific case. I.e. implementing a votingapi hook and calling facebook api from there. Sometimes its better to do that instead of trying to add this to Drupal for Facebook in a generic way. know what I mean?"
first i tried writing a trigger for plus1... it called your fb_actions_profile_fbml, but tokens were missing for title and nid, which renders the action useless.

$fb->api_client->Facebook_showPermissionDialog('status_update'); or some variation that i've tried, doesn't work

this works - but why would anyone want to create a link when the dialog should just be part of the module that needs the permission?

print '<fb:prompt-permission perms="read_stream,publish_stream"> Grant permission for status updates </fb:prompt-permission>';

farceborg is supposedly worth $10billion and this is what they come up with for documentation: http://wiki.developers.facebook.com/index.php/Facebook.showPermissionDialog

sigh-borg

#3

psi-borg - August 27, 2009 - 09:53

//dave, this is what i added to the plus1.module

/**
   * Trigger functions to call fb publish dialog action when a user has voted with plus1
   * Implementation of hook_hook_info().
   */
  function plus1_hook_info() {
    return array(
      'plus1' => array(
        'plus1' => array(
          'insert' => array(
            'runs when' => t('After a user has voted up a node')
         ),
  'update' => array(
            'runs when' => t('After a user has updated their vote on a node')
         )
       ),
     ),
   );
}

  /**
   * Implementation of hook_trigger_name().
   */
  function plus1_plus1($op, $user) {
    // We support a subset of operations.
    if (!in_array($op, array('insert', 'update'))) {
      return;
    }
    $aids = _trigger_get_hook_aids('plus1', $op);
   $context = array(
     'hook' => 'plus1',
     'op' => $op,
     'user' => $user,
   );
   actions_do(array_keys($aids), $user, $context);
}

  /**
   * Implementation of hook_action_info_alter().
   */
  function plus1_action_info_alter(&$info) {
    foreach ($info as $type => $data) {
      //if (stripos($type, "user_") === 0 || stripos($type, "system_") === 0) {
if (stripos($type, "fb_") === 0) {
        if (isset($info[$type]['hooks']['application'])) {
          array_merge($info[$type]['hooks']['plus1'], array('insert', 'update'));
        }
       else {
         $info[$type]['hooks']['plus1'] = array('insert', 'update',);
       }
     }
   }
}

//then inside function plus1_vote()

if ($_REQUEST['fb_sig_in_canvas'] == 1){
module_invoke_all('plus1', 'insert', $user);
}

//this trigger shows up where it's supposed to and your fb dialog action shows as mentioned above, but the tokens are brokens >< <em>any idea why?</em>

#4

psi-borg - August 27, 2009 - 18:56

dave, what i'm failing to understand is why the publish dialog action behaves differently if invoked from different triggers...

 
 

Drupal is a registered trademark of Dries Buytaert.