You are here

function janrain_capture_user_view in Janrain Registration 7.4

Same name and namespace in other branches
  1. 8 janrain_capture.module \janrain_capture_user_view()
  2. 7.2 janrain_capture.module \janrain_capture_user_view()
  3. 7.3 includes/janrain_capture.fancybox.inc \janrain_capture_user_view()

Implementation of hook_user_view to customize profile view

File

./janrain_capture.module, line 1229
This module implements authentication endpoints for Janrain Capture.

Code

function janrain_capture_user_view($account) {
  global $base_url;
  $ver = variable_get('janrain_capture_ver', JANRAIN_CAPTURE_VERSION_DEFAULT);
  $janrain_capture_ui = variable_get('janrain_capture_ui2', array());
  if (!isset($_SESSION['country_id'])) {
    return;
  }
  $janrain_capture_ui = $janrain_capture_ui[$_SESSION['country_id']];
  if ($ver == JANRAIN_CAPTURE_VERSION_LEGACY || isset($janrain_capture_ui['profile_enabled']) == FALSE || $janrain_capture_ui['profile_enabled'] != 1) {
    return $account;
  }
  $uuid = entity_metadata_wrapper('user', $account)->field_janrain_capture_uuid
    ->value();
  $screen = _janrain_capture_get_screen('public-profile.html');
  $account->content = array();
  $account->content['summary'] = array(
    '#type' => 'user_profile_item',
    '#title' => t('Profile'),
    '#markup' => '<div id="janrain-capture-view-profile">' . $screen . '</div>
      <script>
      if(window.location.search != "?uuid=' . $uuid . '") {
        window.location.search = "?uuid=' . $uuid . '";
       }
      jQuery(document).ready(function(){
       if (jQuery(".profile").parent().attr("class") != "fieldset-wrapper") {
        jQuery(".profile").wrap("<div class=\\"fieldset-wrapper\\">");
        jQuery(".fieldset-wrapper").wrap("<fieldset class=\\"form-wrapper\\" id=\\"view-profile\\">");
       }
      });
       </script>',
    '#attributes' => array(
      'class' => array(),
    ),
  );
  if ($js = _janrain_capture_get_screen("public-profile.js")) {

    // JS for the profile screen that should go into <head> before the widget.
    drupal_add_js($js, array(
      'type' => 'inline',
      'every_page' => TRUE,
      'weight' => 2,
      'preprocess' => FALSE,
    ));
  }
  return $account;
}