You are here

function janrain_capture_user_view in Janrain Registration 7.3

Same name and namespace in other branches
  1. 8 janrain_capture.module \janrain_capture_user_view()
  2. 7.4 janrain_capture.module \janrain_capture_user_view()
  3. 7.2 janrain_capture.module \janrain_capture_user_view()

Implementation of hook_user_view to customize profile view

File

includes/janrain_capture.fancybox.inc, line 75
Fancybox functions

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 ($ver == JANRAIN_CAPTURE_VERSION_LEGACY || isset($janrain_capture_ui['profile_enabled']) == false || $janrain_capture_ui['profile_enabled'] != 1) {
    return $account;
  }
  $uuid = $account->field_janrain_capture_uuid['und'][0]['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;
}