You are here

function janrain_capture_profile in Janrain Registration 6

Same name and namespace in other branches
  1. 7.4 includes/janrain_capture.endpoints.inc \janrain_capture_profile()
  2. 7 janrain_capture.pages.inc \janrain_capture_profile()
  3. 7.2 includes/janrain_capture.endpoints.inc \janrain_capture_profile()
  4. 7.3 includes/janrain_capture.endpoints.inc \janrain_capture_profile()

Callback for the janrain_capture/profile menu item. Ensures the access_token is valid before redirecting the user to the Capture profile screen.

1 string reference to 'janrain_capture_profile'
janrain_capture_menu in ./janrain_capture.module
Implements hook_menu().

File

./janrain_capture.pages.inc, line 183
User page callbacks for the janrain_capture module.

Code

function janrain_capture_profile() {
  $method = isset($_GET['method']) ? $_GET['method'] : '';
  $callback = isset($_GET['callback']) ? $_GET['callback'] : 'CAPTURE.closeProfileEditor';
  $janrain_capture_main = variable_get('janrain_capture_main', array());
  $janrain_capture_optional = variable_get('janrain_capture_optional', array());
  $redirect_uri = url('janrain_capture/oauth', array(
    'absolute' => TRUE,
  ));
  if (REQUEST_TIME >= $_SESSION['janrain_capture_expires_in']) {
    $api = new JanrainCaptureApi();
    $api
      ->refreshAccessToken();
  }
  $args = array(
    'action' => 'profile' . $method,
    'access_token' => $_SESSION['janrain_capture_access_token'],
    'callback' => $callback,
  );
  $url = janrain_capture_url($args);
  drupal_goto($url);
}