summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Cohen2010-12-28 22:35:27 (GMT)
committer Dave Cohen2010-12-28 22:35:27 (GMT)
commitb26c58b45a83dcaad24dcdf8f7d4499004ade2de (patch)
tree651f10a794198d28ce910b56ea933ebdbfbf0648
parent814e53cfb8f1744fa49ab0b898f9563978b0c514 (diff)
#975832: do not alter user add form
-rw-r--r--contrib/fb_registration.module12
-rw-r--r--fb_user.module7
2 files changed, 12 insertions, 7 deletions
diff --git a/contrib/fb_registration.module b/contrib/fb_registration.module
index acc1083..0c7b1ce 100644
--- a/contrib/fb_registration.module
+++ b/contrib/fb_registration.module
@@ -31,6 +31,9 @@ function _fb_registration_form_alter_fields(&$form) {
}
}
+/**
+ * Implements hook_form_alter().
+ */
function fb_registration_form_alter(&$form, &$form_state, $form_id) {
if (!isset($GLOBALS['_fb'])) {
@@ -38,9 +41,12 @@ function fb_registration_form_alter(&$form, &$form_state, $form_id) {
return;
}
+ if ($GLOBALS['user']->uid) {
+ // No need to alter user add form.
+ return;
+ }
if ($form_id == 'user_register') {
-
// Replace regular form with fb_registration.
$form['#fb_registration'] = TRUE;
@@ -48,8 +54,6 @@ function fb_registration_form_alter(&$form, &$form_state, $form_id) {
_fb_registration_form_alter_fields($form);
}
-
-
if (isset($form['#fb_registration'])) {
// Registration has been enabled for this form.
@@ -173,7 +177,7 @@ function _fb_registration_extract_fb_fields(&$fb_fields, &$form) {
'name' => $key,
'type' => 'checkbox',
'description' => $form[$key]['#title'],
- 'default' => $form[$key]['#default_value'],
+ 'default' => isset($form[$key]['#default_value']) ? $form[$key]['#default_value'] : NULL,
);
}
elseif ($form[$key]['#type'] == 'select') {
diff --git a/fb_user.module b/fb_user.module
index 4737071..686c3f2 100644
--- a/fb_user.module
+++ b/fb_user.module
@@ -488,9 +488,10 @@ function fb_user_form_alter(&$form, &$form_state, $form_id) {
// Add name and email to some forms.
if (isset($GLOBALS['_fb'])) {
$fb = $GLOBALS['_fb'];
- if (($form_id == 'user_register' && variable_get(FB_USER_VAR_ALTER_REGISTER, TRUE)) ||
- ($form_id == 'user_login' && variable_get(FB_USER_VAR_ALTER_LOGIN, TRUE)) ||
- ($form_id == 'user_login_block' && variable_get(FB_USER_VAR_ALTER_LOGIN_BLOCK, TRUE))) {
+ if (!$GLOBALS['user']->uid && // No alters to user add form.
+ (($form_id == 'user_register' && variable_get(FB_USER_VAR_ALTER_REGISTER, TRUE)) ||
+ ($form_id == 'user_login' && variable_get(FB_USER_VAR_ALTER_LOGIN, TRUE)) ||
+ ($form_id == 'user_login_block' && variable_get(FB_USER_VAR_ALTER_LOGIN_BLOCK, TRUE)))) {
if ($fbu = fb_facebook_user()) {
// Facebook user has authorized app.