Index: gigya-link-accounts.tpl.php
===================================================================
RCS file: gigya-link-accounts.tpl.php
diff -N gigya-link-accounts.tpl.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gigya-link-accounts.tpl.php	4 Aug 2010 14:03:56 -0000
@@ -0,0 +1,17 @@
+<?php
+// $Id$
+
+/**
+ * @file gigya-link-accounts.tpl.php
+ * Default theme implementation for displaying a Gigya account link form.
+ *
+ * Available variables:
+ * - $form_title: Title text for the form.
+ * - $link_form: Complete Gigya account linking form.
+ *
+ * @see template_preprocess_gigya_link_accounts()
+ */
+?>
+
+<h3><?php print $form_title; ?></h3>
+<?php print $link_form; ?>
Index: gigya-login-block.tpl.php
===================================================================
RCS file: gigya-login-block.tpl.php
diff -N gigya-login-block.tpl.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gigya-login-block.tpl.php	4 Aug 2010 14:03:56 -0000
@@ -0,0 +1,20 @@
+<?php
+// $Id$
+
+/**
+ * @file gigya-login-block.tpl.php
+ * Default theme implementation for displaying a gigya login form.
+ *
+ * Available variables:
+ * - $login_div: Contents of the login block.
+ * - $title: Title to display, if not suppressed.
+ *
+ * @see template_preprocess_gigya_login_block()
+ */
+?>
+ 
+<?php if ($title) : ?>
+  <h3><?php print $title; ?></h3>
+<?php endif; ?>
+
+<div class="gigya-login"><?php print $login_div; ?></div>
Index: gigya-register.tpl.php
===================================================================
RCS file: gigya-register.tpl.php
diff -N gigya-register.tpl.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gigya-register.tpl.php	4 Aug 2010 14:03:57 -0000
@@ -0,0 +1,25 @@
+<?php
+// $Id$
+
+/**
+ * @file gigya-register.tpl.php
+ * Default theme implementation for displaying a gigya registration form.
+ *
+ * Available variables:
+ * - $title: Title of the form.
+ * - $message: Explanatory text for the form.
+ * - $registration_form: The user registration form.
+ * - $link_accounts_form: Form to link networks to account.
+ *
+ * @see template_preprocess_gigya_register()
+ */
+?>
+
+<h2><?php print $title; ?></h2>
+<p><?php print $message; ?></p>
+
+<?php print $registration_form; ?>
+
+<?php if (variable_get('gigya_enable_linking', TRUE)) : ?>
+  <?php print $link_accounts_form; ?>
+<?php endif; ?>
Index: gigya-user-profile.tpl.php
===================================================================
RCS file: gigya-user-profile.tpl.php
diff -N gigya-user-profile.tpl.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gigya-user-profile.tpl.php	4 Aug 2010 14:03:57 -0000
@@ -0,0 +1,28 @@
+<?php
+// $Id$
+
+/**
+ * @file gigya-user-profile.tpl.php
+ * Default theme implementation for displaying gigya user profile information.
+ *
+ * Available variables:
+ * - $bio: Array of network user information.
+ * - $photo: User photo.
+ * - $name: Formatted user nickname.
+ *
+ * @see template_preprocess_gigya_user_profile()
+ */
+?>
+
+<div id="<?php print $bio['provider']; ?>_profile">
+
+  <?php print $photo; ?>
+
+  <?php if ($name) : ?>
+    <div class="socialize_nickname">
+    <?php print $name; ?>
+    </div>
+  <?php endif; ?>
+
+</div>
+  
\ No newline at end of file
Index: gigya.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gigya/gigya.module,v
retrieving revision 1.5
diff -u -p -r1.5 gigya.module
--- gigya.module	4 Aug 2010 13:59:40 -0000	1.5
+++ gigya.module	4 Aug 2010 14:03:58 -0000
@@ -1016,22 +1016,32 @@ function gigya_set_notify_login_params($
  */
 function gigya_theme() {
   return array(
-    'gigya_connect_display' => array(
-    ),
-    'gigya_login_block' => array(
-      'arguments' => array('form_id'),
-    ),
-    'gigya_user_profile' => array(
-      'arguments' => array('bio'),
-    ),
+    'gigya_connect_display' => array(),
     'gigya_friends' => array(
-      'arguments' => array('friends'),
+      'arguments' => array('friends' => NULL),
     ),
     'gigya_link_accounts' => array(
       'arguments' => array('form' => NULL),
+      'template' => 'gigya-link-accounts',
     ),
     'gigya_register' => array(
-      'arguments' => array('bio', 'registration_form', 'link_accounts_form'),
+      'arguments' => array(
+        'bio' => NULL,
+        'registration_form' => NULL,
+        'link_accounts_form' => NULL,
+      ),
+      'template' => 'gigya-register',
+    ),
+    'gigya_login_block' => array(
+      'arguments' => array(
+        'form_id' => NULL,
+        'suppress_title' => FALSE,
+      ),
+      'template' => 'gigya-login-block',
+    ),
+    'gigya_user_profile' => array(
+      'arguments' => array('bio' => NULL),
+      'template' => 'gigya-user-profile',
     ),
   );
 }
@@ -1039,6 +1049,22 @@ function gigya_theme() {
 /**
  * Undocumented Function!
  *
+ * @return
+ *   Undocumented Return!
+ *
+ * @ingroup themeable
+ */
+function theme_gigya_connect_display() {
+  global $user;
+
+  if ($user->uid) {
+    return gigya_connectui_js();
+  }
+}
+
+/**
+ * Undocumented Function!
+ *
  * @param $friends
  *   Undocumented Parameter!
  *
@@ -1090,121 +1116,80 @@ function theme_gigya_friends($friends) {
 }
 
 /**
- * Undocumented Function!
+ * Process variables for gigya-link-accounts.tpl.php.
  *
- * @return
- *   Undocumented Return!
+ * The $variables array contains the following arguments:
+ * - $form: Gigya link accounts form.
  *
- * @ingroup themeable
- */
-function theme_gigya_connect_display() {
-  global $user;
-
-  if ($user->uid) {
-    return gigya_connectui_js();
+ * @see gigya-link-accounts.tpl.php
+ **/
+function template_preprocess_gigya_link_accounts(&$variables) {
+  if (variable_get('gigya_enable_linking', TRUE)) {
+    $variables['form_title'] = t('Or log in to link your existing account to this social network');
+    $variables['link_form'] = drupal_render($variables['form']);
   }
 }
 
 /**
- * Undocumented Function!
+ * Process variables for gigya-register.tpl.php.
  *
- * @param $form_id
- *   Undocumented Parameter!
- * @param $suppress_title
- *   Undocumented Parameter!
+ * The $variables array contains the following arguments:
+ * - $bio: Gigya user object.
+ * - $registration_form: Drupal user registration form.
+ * - $link_accounts_form: Gigya link accounts form.
  *
- * @ingroup themeable
- */
-function theme_gigya_login_block($form_id = NULL, $suppress_title = FALSE) {
-  $login_div = gigya_loginui_js();
-  $output = '';
+ * @see gigya-register-form.tpl.php
+ **/
+function template_preprocess_gigya_register(&$variables) {
+  $variables['title'] = t('Complete your registration');
+  $variables['message'] = t('You have been authenticated via %provider. Please complete your registration below.', array('%provider' => $variables['bio']['loginProvider']));
+}
 
-  if (!$suppress_title) {
-    $title = t('Login using social networks');
-    $output .= '<h3>'. $title .'</h3>';
+/**
+ * Process variables for gigya-login-block.tpl.php.
+ *
+ * The $variables array contains the following arguments:
+ * - $form_id
+ * - $suppress_title
+ *
+ * @see gigya-login-block.tpl.php
+ **/
+function template_preprocess_gigya_login_block(&$variables) {
+  $variables['login_div'] = gigya_loginui_js();
+  if (!$variables['suppress_title']) {
+    $variables['title'] = t('Login using social networks');
   }
-
-  $output .= '<div class="gigya-login">' . $login_div . '</div>';
-  return $output;
 }
 
 /**
- * Undocumented Function!
+ * Process variables for gigya_user-profile.tpl.php.
  *
- * @param $bio
- *   Undocumented Parameter!
+ * The $variables array contains the following arguments:
+ * - $bio
  *
- * @ingroup themeable
- */
-function theme_gigya_user_profile($bio) {
+ * @see gigya-user-profile.tpl.php
+ **/
+function template_preprocess_gigya_user_profile(&$variables) {
   global $base_url;
-  $content = '';
-
-  $content .= '<div id="' . $bio['provider'] . '_profile">';
-
+  $bio = $variables['bio'];
+  
+  // Figure out what to print for the picture.
   if ($bio['thumbnailURL']) {
-    $content .= '<img id="photo" src="' . $bio['thumbnailURL'] . '" />';
+    //$variables['photo'] = '<img id="photo" src="' . $bio['thumbnailURL'] . '" />';
+    $variables['photo'] = theme('image', $bio['thumbnailURL'], 'Photo of' . $bio['nickname'], 'Photo of' . $bio['nickname'], array('id' => 'photo'), FALSE);
   }
   elseif ($bio['photoURL']) {
-    $content .= '<img id="photo" src="' . $bio['photoURL'] . '" />';
+    $variables['photo'] = theme('image', $bio['photoURL'], 'Photo of' . $bio['nickname'], 'Photo of' . $bio['nickname'], array('id' => 'photo'), FALSE);
   }
+  // If nothing else, then use the default avatar image.
   else {
-    $content .= '<img id="photo" src="' . $base_url . '/' . drupal_get_path('module', 'gigya') . '/silhouette.gif' . '" />';
-  }
-
-  if ($bio['nickname']) {
-    $content .= '<div class="socialize_nickname">';
-    $content .= $bio['profileURL'] ? l($bio['nickname'], $bio['profileURL']) : $bio['nickname'];
-    $content .= '</div>';
-  }
-
-  $content .= '</div>';
-
-  return $content;
-}
-
-/**
- * Undocumented Function!
- *
- * @param $form
- *   Undocumented Parameter!
- *
- * @ingroup themeable
- */
-function theme_gigya_link_accounts($form) {
-  $output = '';
-
-  if (variable_get('gigya_enable_linking', TRUE)) {
-    $output .= '<h3>' . t('Or log in to link your existing account to this social network') . '</h3>';
-    $output .= drupal_render($form);
-  }
-
-  return $output;
-}
-
-/**
- * Undocumented Function!
- *
- * @param object $bio
- *   A Gigya user object as documented here: http://wiki.gigya.com/030_Gigya_Socialize_API_2.0/030_API_reference/Objects/User_object
- * @param $registration_form
- *   Undocumented Parameter!
- * @param $link_accounts_form
- *   Undocumented Parameter!
- *
- * @ingroup themeable
- */
-function theme_gigya_register($bio, $registration_form, $link_accounts_form) {
-  $output = '';
-
-  $output .= '<h2>' . t('Complete your registration') . '</h2>';
-  $output .= '<p>' . t('You have been authenticated via %provider. Please complete your registration below.', array('%provider' => $bio['loginProvider'])) . '</p>';
-  $output .= $registration_form;
-
-  if (variable_get('gigya_enable_linking', TRUE)) {
-    $output .= $link_accounts_form;
+    //$variables['photo'] =  '<img id="photo" src="' . $base_url . '/' . drupal_get_path('module', 'gigya') . '/silhouette.gif' . '" />';
+    $variables['photo'] = theme('image', drupal_get_path('module', 'gigya') . '/silhouette.gif', 'Photo of' . $bio['nickname'], 'Photo of' . $bio['nickname'], array('id' => 'photo'), FALSE);
   }
-  return $output;
+  
+  // Print out the user nickname.
+  $variables['name'] = $bio['profileURL'] ? l($bio['nickname'], $bio['profileURL']) : $bio['nickname'];
+  
 }
 
 /**
