diff --git a/html/inc/prefs.inc b/html/inc/prefs.inc
index edda1151cf..e7db01e37d 100644
--- a/html/inc/prefs.inc
+++ b/html/inc/prefs.inc
@@ -564,8 +564,6 @@ function print_prefs_form(
$action, $subset, $venue, $user, $prefs, $cols, $error=false,
$project_error=false
){
- $config = get_config();
-
if ($action == "add") {
$script = "add_venue.php";
$submit_value = tra("Add preferences");
@@ -590,10 +588,7 @@ function print_prefs_form(
prefs_form_project($prefs, $error);
if (!$venue) {
prefs_form_privacy($user);
- if (parse_bool($config, "enable_record_optin_consent")) {
- prefs_form_consent($user);
- }
- venue_form($user);
+ prefs_form_consent($user);
}
prefs_form_project_specific($prefs->project_specific, $project_error);
}
diff --git a/html/inc/prefs_project.inc b/html/inc/prefs_project.inc
index b3bcf991c5..9a34e946df 100644
--- a/html/inc/prefs_project.inc
+++ b/html/inc/prefs_project.inc
@@ -137,15 +137,20 @@ $privacy_pref_descs = array (
),
);
-$privacy_consent_descs = array(
- new PREF_CONSENT(
- tra("Do you consent to %1 exporting your data?", PROJECT),
- tra("Data is exported to BOINC statistics aggregation Web sites."),
- "consent_data_export",
- "STATSEXPORT",
+// Privacy preferences located in consent_type table. Loop over the
+// table and extract those consent types with enabled=1 and
+// privacypref=1.
+$privacy_consent_descs = array();
+$_consenttypes = BoincConsentType::enum("enabled=1 AND privacypref=1", "ORDER BY protected DESC");
+foreach ($_consenttypes as $ct) {
+ $privacy_consent_descs[] = new PREF_CONSENT(
+ tra($ct->description),
+ tra($ct->description),
+ "consent_".urlencode($ct->shortname),
+ $ct->shortname,
0
- ),
-);
+ );
+}
global $text;
global $parse_result;
@@ -290,7 +295,6 @@ function prefs_show_project_specific($prefs, $columns=false) {
}
function print_prefs_display_project($user, $columns=false) {
- $config = get_config();
$project_prefs = prefs_parse_project($user->project_prefs);
$switch_link = " ".tra("(Switch View)")."";
@@ -311,9 +315,7 @@ function print_prefs_display_project($user, $columns=false) {
}
prefs_show_project($project_prefs, false);
prefs_show_privacy($user, false);
- if (parse_bool($config, "enable_record_optin_consent")) {
- prefs_show_consent($user, false);
- }
+ prefs_show_consent($user, false);
venue_show($user);
prefs_show_project_specific($project_prefs, false);
$tokens = url_tokens($user->authenticator);
diff --git a/html/inc/prefs_util.inc b/html/inc/prefs_util.inc
index fbe8fb30a1..5317d6695d 100644
--- a/html/inc/prefs_util.inc
+++ b/html/inc/prefs_util.inc
@@ -257,9 +257,17 @@ class PREF_CONSENT extends PREF {
if ($this->invert) $formget = !$formget;
$flag = ($formget ? 1 : 0);
- $rc = consent_to_a_policy($user, $consent_name, $flag, 0, 'Webform', time());
- if (!$rc) {
- error_page(tra("Database error:").BoincDb::error());
+ // Check to see if latest consent of this name is already
+ // given, i.e., consent_flag set to "formget". If not, consent
+ // to this consent type.
+ $cr= BoincConsent::lookup("userid={$user->id} AND consent_name='${consent_name}' ORDER BY consent_time DESC LIMIT 1");
+
+ if ( (($cr) and ($cr->consent_flag!=$flag)) or
+ (!$cr) ) {
+ $rc = consent_to_a_policy($user, $consent_name, $flag, 0, 'Webform', time());
+ if (!$rc) {
+ error_page(tra("Database error:").BoincDb::error());
+ }
}
}
// xml_string should not be used for this class
diff --git a/html/user/prefs_edit.php b/html/user/prefs_edit.php
index 0069215773..57e487056c 100644
--- a/html/user/prefs_edit.php
+++ b/html/user/prefs_edit.php
@@ -21,8 +21,6 @@ include_once("../inc/util.inc");
include_once("../inc/prefs.inc");
include_once("../inc/prefs_project.inc");
-$config = get_config();
-
$user = get_logged_in_user();
$action = sanitize_tags(get_str("action", true));
@@ -79,9 +77,7 @@ if ($action) {
} else {
$main_prefs = $prefs;
prefs_privacy_parse_form($user);
- if (parse_bool($config, "enable_record_optin_consent")) {
- prefs_consent_parse_update($user);
- }
+ prefs_consent_parse_update($user);
}
project_prefs_update($user, $main_prefs);