From 33564cee9427fe5d66777e50993c38d191e1711b Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 12 Jun 2008 20:59:12 +0000 Subject: [PATCH] Add POD to the ProfileField, formField method. Fix all profile field defaults being ignored by the createAccount screen. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Auth.pm | 9 ++++++--- lib/WebGUI/ProfileField.pm | 9 +++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index e7de5bf3e..87e83fdbe 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -116,6 +116,7 @@ - fix: too small of a field for content profiling - fix: Wrong class assignment in "News" template - fix: malformed css in default wiki page + - fix: User profiling default broken 7.5.10 - fix: Syntax error in GetCsMail diff --git a/lib/WebGUI/Auth.pm b/lib/WebGUI/Auth.pm index 5af7aecea..927ced021 100644 --- a/lib/WebGUI/Auth.pm +++ b/lib/WebGUI/Auth.pm @@ -194,20 +194,23 @@ sub createAccount { foreach my $field (@{WebGUI::ProfileField->getRegistrationFields($self->session)}) { my $id = $field->getId; my $label = $field->getLabel; - my $defaultValue = undef; # Get the default email from the invitation + my $formField; if ($field->get('fieldName') eq "email" && $userInvitation ) { my $code = $self->session->form->get('code') || $self->session->form->get('uniqueUserInvitationCode'); - $defaultValue + my $defaultValue = $self->session->db->quickScalar( 'SELECT email FROM userInvitations WHERE inviteId=?', [$code] ); $vars->{'create.form.header'} .= WebGUI::Form::hidden($self->session, {name=>"uniqueUserInvitationCode", value=>$code}); + $formField = $field->formField(undef, undef, undef, undef, $defaultValue); + } + else { + $formField = $field->formField(); } - my $formField = $field->formField(undef, undef, undef, undef, $defaultValue); my $required = $field->isRequired; # Old-style field loop. diff --git a/lib/WebGUI/ProfileField.pm b/lib/WebGUI/ProfileField.pm index e6a6f4511..763a4218d 100644 --- a/lib/WebGUI/ProfileField.pm +++ b/lib/WebGUI/ProfileField.pm @@ -217,6 +217,15 @@ An integer indicating whether to return just the field's form input, or the fiel A WebGUI::User object reference to use instead of the currently logged in user. +=head3 skipDefault + +If true, this causes the default value set up for the form field to be ignored. + +=head3 assignedValue + +If assignedValue is defined, it will be used to override the default value set up for the +form. + =cut sub formField {