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
|
|
@ -22,6 +22,7 @@
|
|||
that still allows non-realm based Basic authentication.
|
||||
- fixed #10228: Calendar: Weekly re-occurence function not working properly
|
||||
( Martin Kamerbeek / Oqapi )
|
||||
- fixed #9851: New Users have blank profile field privacy settings
|
||||
|
||||
7.7.8
|
||||
- fixed: Basic Auth doesn't work if password contains colon (Arjan Widlak,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ my $session = start(); # this line required
|
|||
# upgrade functions go here
|
||||
repackTemplates( $session );
|
||||
deleteUnattachedAddressBooks( $session );
|
||||
addDefaultPrivacySettings( $session );
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
|
@ -47,6 +48,16 @@ finish($session); # this line required
|
|||
# print "DONE!\n" unless $quiet;
|
||||
#}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub addDefaultPrivacySettings {
|
||||
my $session = shift;
|
||||
print "\tAdding default privacy setting to profile fields..." unless $quiet;
|
||||
$session->db->write("alter table userProfileField add defaultPrivacySetting char(128);");
|
||||
$session->db->write("update userProfileField set defaultPrivacySetting = 'all' where profileCategoryId IN(2,3,6);");
|
||||
$session->db->write("update userProfileField set defaultPrivacySetting = 'none' where !(profileCategoryId IN(2,3,6));");
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Repack all templates since the packed columns may have been wiped out due to the bug.
|
||||
sub repackTemplates {
|
||||
|
|
|
|||
|
|
@ -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