fixed #9851: New Users have blank profile field privacy settings
This commit is contained in:
parent
8d12d12db0
commit
1ea08936f4
5 changed files with 48 additions and 1 deletions
|
|
@ -301,7 +301,14 @@ sub www_editProfileField {
|
|||
-value=>$data->{forceImageOnly},
|
||||
-defaultValue=>1,
|
||||
);
|
||||
}
|
||||
}
|
||||
$f->radioList(
|
||||
-name => 'defaultPrivacySetting',
|
||||
-label => $i18n->get('default privacy setting label'),
|
||||
-hoverHelp => $i18n->get('default privacy setting description'),
|
||||
-options => WebGUI::ProfileField->getPrivacyOptions($session),
|
||||
-value => $data->{defaultPrivacySetting}
|
||||
);
|
||||
my $fieldType = WebGUI::Form::FieldType->new($session,
|
||||
-name=>"fieldType",
|
||||
-label=>$i18n->get(486),
|
||||
|
|
@ -377,6 +384,7 @@ sub www_editProfileFieldSave {
|
|||
fieldType=>$session->form->fieldType("fieldType"),
|
||||
forceImageOnly=>$session->form->yesNo("forceImageOnly"),
|
||||
extras=>$session->form->text('extras'),
|
||||
defaultPrivacySetting=>$session->form->radioList('defaultPrivacySetting'),
|
||||
);
|
||||
my $categoryId = $session->form->selectBox("profileCategoryId");
|
||||
if ($session->form->process("new")) {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ use WebGUI::Workflow::Instance;
|
|||
use WebGUI::Shop::AddressBook;
|
||||
use JSON;
|
||||
use WebGUI::Exception;
|
||||
use WebGUI::ProfileField;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -83,6 +84,19 @@ sub _create {
|
|||
my $userId = shift || $session->id->generate();
|
||||
$session->db->write("insert into users (userId,dateCreated) values (?,?)",[$userId, time()]);
|
||||
$session->db->write("INSERT INTO userProfileData (userId) VALUES (?)",[$userId]);
|
||||
|
||||
# Set wg_privacySettings
|
||||
my @fields = @{WebGUI::ProfileField->getFields($session)};
|
||||
my $privacy = {};
|
||||
foreach my $field (@fields) {
|
||||
#$session->errorHandler->warn('getting privacy setting for field: '.$fieldName);
|
||||
my $privacySetting = $field->get('defaultPrivacySetting');
|
||||
next unless (WebGUI::Utility::isIn($privacySetting,qw(all none friends)));
|
||||
$privacy->{$field->get('fieldName')} = $privacySetting;
|
||||
}
|
||||
my $json = JSON->new->encode($privacy);
|
||||
$session->db->write("update userProfileData set wg_privacySettings=? where userId=?",[$json,$userId]);
|
||||
|
||||
WebGUI::Group->new($session,2)->addUsers([$userId]);
|
||||
WebGUI::Group->new($session,7)->addUsers([$userId]);
|
||||
return $userId;
|
||||
|
|
|
|||
|
|
@ -418,6 +418,19 @@ If you wish to set the Default Value for any other field. Create the field with
|
|||
message => q|Extra HTML to include with this profile field.|,
|
||||
lastUpdated => 1224620527,
|
||||
},
|
||||
|
||||
'default privacy setting label' => {
|
||||
message => q|Default Privacy Setting|,
|
||||
lastUpdated => 0,
|
||||
context => q|Label for a profile field property on the Edit User Profile Field screen.|,
|
||||
},
|
||||
|
||||
'default privacy setting description' => {
|
||||
message => q|Select the default privacy setting for this profile field. This will be used when a new user is created.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Description for a profile field property, used as hoverhelp on the Edit User Profile Field screen.|,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue