FBOauth: how to pass arguments to the callback function? I am trying to create a facebook event through a drupal content type "event". I call the hook_node_insert() to make a POST on Facebook.

function fb_event_create_node_insert($node){
    if ($node-&gt;type == "event"){
        // get field values submitted when a new content type "event" is saved
        $event_name = $node-&gt;field_event_name['und'][0]['value'];
        $event_start_date = $node-&gt;field_event_start_date['und'][0]['value'];

        // get facebook app_id &amp; secret from fboauth variables
        $app_id = isset($app_id) ? $app_id : variable_get('fboauth_id', '');
        $app_secret = isset($app_secret) ? $app_secret : variable_get('fboauth_secret', '');

        // Get the link to get the facebook code (generated by fboauth module)
        $link = fboauth_action_link_properties('fb_event_create'); 

        print l(t('Create event'), $link['href'], array('query' =&gt; $link['query']));
        // output a link to https://www.facebook.com/dialog/oauth?client_id=CLIENT_ID&amp;redirect_uri=http%3A//localhost%3A8888/cs/%3Fq%3Dfboauth%252Ffb_event_create&amp;scope=manage_pages%2Ccreate_event
        // parameters are created by the fb_oauth action (scope=permission) and some settings of the module (client_id &amp; redirect uri).

    }
}


So I then have a link after having saved the node: when I click on it, it connects to facebook and gives me back a code as a parameter in my redirect uri (code has been modified): 

http://localhost:8888/cs/?q=fboauth%2Ffb_event_create&amp;code=AQDEvaeupRO-FE6lWaKXZFqvoSRnSuKlIdVjMDeGoy5su-hXpgCcGnBsyCzcPDl5YGGc3hj1yPAXheBjmFtGuivmM-lm5jlm5QG2UeFLPg3gQfnWM3UvB10Y-yrYPyr176dyuMI2Q3vvHGM8z-YVKpYkzPPgYUEifEDIbvADokgniNFiiwpyWZCS72GD32zWLxWCBkCThRk8o3MnO2vWXAmc#_=_


It goes to the callback function defined earlier:

function fb_event_create_fboauth_actions() {
  $actions['fb_event_create'] = array(
    'title' =&gt; t('Create events on behalf of CS'),
    'callback' =&gt; 'fb_event_create_fboauth_action_event_create',
    'permissions' =&gt; array(
      'manage_pages,create_event'),
  );
  return $actions;
}


And here is the callback function:

function fb_event_create_fboauth_action_event_create($app_id, $access_token) {
    $result = fboauth_graph_query("EVENT_ID/events", $access_token, array("name" =&gt; "test", "start_time" =&gt; "2013-04-04T19:00:00-0700"), 'POST');
}


WHAT I WANT:

Insert parameters to this callback function to be able to insert the $event_name and $event_start_date (that we find from the node_insert() hook above) to have the callback function like :

function fb_event_create_fboauth_action_event_create($app_id, $access_token, $name_fb_ev, $start_fb_ev) {
    $result = fboauth_graph_query("EVENT_ID/events", $access_token, array("name" =&gt; $name_fb_ev, "start_time" =&gt; $start_fb_ev), 'POST');
}


Thank you for any help guys!
I modified the fboauth_action_menu() to make it accept arguments:

function fboauth_menu() {
  $items['fboauth/%fboauth_action/%/%'] = array(
    'title' =&gt; 'Facebook connect',
    'page callback' =&gt; 'fboauth_action_page',
    'page arguments' =&gt; array(1, 'foo', 'foo'),
    'access callback' =&gt; TRUE,
    'file' =&gt; 'includes/fboauth.fboauth.inc',
    'type' =&gt; MENU_CALLBACK,
  );
  return $items;
}


But then I had another problem with the function fboauth_action_page()it executed because it called the another function to get the access token because the two redirect_uri parameters were not the same between the code request to FB and the access token. All this, because the function to get the access token was not taking into account the parameters.

function fboauth_access_token($code, $action_name, $app_id = NULL, $app_secret = NULL) {
  $app_id = isset($app_id) ? $app_id : variable_get('fboauth_id', '');
  $app_secret = isset($app_secret) ? $app_secret : variable_get('fboauth_secret', '');

  // get the parameters from the redirect_uri by the drupal function arg() and includes them in the redirect_uri to get the access token.
  $query = array(
    'client_id' =&gt; $app_id,
    'client_secret' =&gt; $app_secret,
    'redirect_uri' =&gt; fboauth_action_url('fboauth/' . $action_name . "/" . arg(2) . "/" . arg(3) . "/", array('absolute' =&gt; TRUE, 'query' =&gt; !empty($_GET['destination']) ? array('destination' =&gt; $_GET['destination']) : array())),
    'code' =&gt; $code,
  );

// rest of the function

}


Now, both redirect_uri are the same and my callback function defined earlier must also catch parameters from the url:

function fb_event_create_fboauth_action_event_create($app_id, $access_token) {
    $event_name = arg(2);
    $event_start_date = arg(3);

    $result = fboauth_graph_query("EVENT_ID/events", $access_token, array("name" =&gt; $event_name, "start_time" =&gt; $event_start_date), 'POST');

}


Hope this helps someone!