Line 52 in fboauth.fboauth.inc

No where in this function does it check for an includes file within the $action variable.

/**
 * Invoke an action specified through hook_fboauth_action_info().
 */
function fboauth_action_invoke($action_name, $app_id, $access_token) {
  $action = fboauth_action_load($action_name);
  // Call the specified action.
  if (isset($action['callback'])) {
    $callback = $action['callback'];

    if (function_exists($callback)) {
      return $callback($app_id, $access_token);
    }
  }
}

This function will not call a custom action's function if the function is in an include file. Setting the 'file' parameter of your custom action is not recognized.

To solve this problem I simply put my custom action function inside my custom module, but tracking down the reason why it wasn't working took some time.

  $actions['login'] = array(
    'title' => t(Login'),
    'file' => 'includes/mymodule.fboauth.inc', // <------- This does nothing...
    'callback' => 'mymodule_action_login',
    'permissions' => array_keys(fboauth_user_connect_permissions()),
  );

Comments

K.MacKenzie’s picture

Oh and thanks for the Module. Aside from this little bug it has been working great for my purposes!

quicksketch’s picture

Hm, yep sure enough! I'll take a look at this next time I'm going through the FBOAuth queue.

quicksketch’s picture

Status: Active » Postponed (maintainer needs more info)

It looks like fboauth_action_load() does the inclusion:

function fboauth_action_load($action_load) {
  ...

  // Include any necessary includes for the file.
  if ($action) {
    if (isset($action['file'])) {
      $file = './' . $action['file path'] . '/' . $action['file'];
      if (file_exists($file)) {
        include_once $file;
      }
    }
  }

  return $action;
}

Since fboauth_action_load() is called on the first line of fboauth_action_invoke(), the necessary include file is loaded properly.

In my testing this is operating correctly. Please reopen if you've found that this is not the case.

quicksketch’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)