From 78941786295b6eb179cc926bf7d0d20a59fcfb00 Mon Sep 17 00:00:00 2001
From: Josh Walker <josh@marmaladesoul.com>
Date: Tue, 19 Feb 2013 16:21:13 -0800
Subject: [PATCH] fix for user form

---
 modules/callbacks.inc |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/modules/callbacks.inc b/modules/callbacks.inc
index dca9e1d..39fd989 100644
--- a/modules/callbacks.inc
+++ b/modules/callbacks.inc
@@ -873,10 +873,18 @@ function entity_metadata_form_comment($comment) {
  * Callback to get the form of a user account.
  */
 function entity_metadata_form_user($account) {
-  // Pre-populate the form-state with the right form include.
+  // If $account->uid is set then we want a user edit form.
+  // Otherwise we want the user register form.
+  if (isset($account->uid)) {
+    $form_id = 'user_profile_form';
+    form_load_include($form_state, 'inc', 'user', 'user.pages');
+  }
+  else {
+    $form_id = 'user_register_form';
+  }
+  
   $form_state['build_info']['args'] = array($account);
-  form_load_include($form_state, 'inc', 'user', 'user.pages');
-  return drupal_build_form('user_profile_form', $form_state);
+  return drupal_build_form($form_id, $form_state);
 }
 
 /**
-- 
1.7.9.6 (Apple Git-31.1)

