Hi all,
is not completely clear to me if custom actions automatically do facebook connection process for anonymous users.
I'll try to explain better with the following example:
- I'm creating a custom action that retrieves a user FB events.
- My custom action button "Import your Facebook events" is shown to everyone, authenticated (who already has done FB connect) and anonymous users.
- The above custom action works well only for authenticated users, and doesn't work with anonymous ones.
To resolve the issue I included fboauth_action_connect default action inside my custom action, like this:
/**
* Facebook OAuth action callback; Get a list of user's Facebook events.
*/
function _fb_stuff_get_events($app_id, $access_token) {
if (!user_is_logged_in()) {
fboauth_action_connect($app_id, $access_token);
}
// Query against the Facebook Graph API.
$result = fboauth_graph_query('me/events', $access_token);
...
...
In this way FB connection process is called for anonymous BEFORE custom action code.
Is the above the correct way to proceed? There is a better way to reach the goal?
Thank you very much
Comments