I am using fboauth for enabling login with facebook for the website. Here is an overview of how I achieve the functionality:
When the user clicks on the facebook login button on the website, he or she is taken to a facebook login page. After logging in with facebook, the user is taken to the app authorization page where the user asks for permission to connect with the app. Once necessary permissions are granted, a local account (account at my website) is automatically created for the user and the user is brought back to a welcome page to set password. The user won't even have to verify their email address. On subsequent visits, when the user clicks on the login link, he/she is taken to the same facebook login page where they supply their login credentials. On successful login, they are brought back to the website. So far, everything works fine with the fboauth module.
What I am trying to achieve now is a functionality similar to what is found with the fbconnect module. The user is provided with a block/page where the user can import the list of his friends who has authorized with the app, and see the links to their local accounts (accounts at the website). How to achieve this functionality? The fboauth module has its own API which can be utilized. Here is what I already have, written using the API of fboauth.
<?php function mymodule_fboauth_actions() { $actions['mymodule_friend_import'] = array( 'title' => t('Imports your friends), 'callback' => 'mymodule_fboauth_action_friend_import', 'permissions' => array( 'user_friends', ), ); return $actions; } function mymodule_fboauth_action_friend_import($app_id, $access_token) { $result = fboauth_graph_query('me/friends?fields=name', $access_token); drupal_set_message(t('Import complete!')); } ?>
This will import all the friends of a user as an object into $result. However, what I am finding it difficult is to display those names with the user's corresponding local accounts (accounts at the website). This is because of my lack of knowledge in php. What I am looking for is here is the exact lines of code that can be inserted after $result recieves its value so that the names of the users are displayed along with the links to their profile pages at my website.