Selaa lähdekoodia

Add newsletter consent filter

Alan Lam 3 vuotta sitten
vanhempi
commit
2a13b3946e
2 muutettua tiedostoa jossa 13 lisäystä ja 1 poistoa
  1. 5 1
      controllers/users_export.php
  2. 8 0
      views/modals/user_export.php

+ 5 - 1
controllers/users_export.php

@@ -18,9 +18,13 @@ switch($type) {
 
 		$nvp = [
 			"email" => (new Constraint("IS_NOT_NULL")),
-			"newsletter_consent" => 1,
 		];
 
+		$newsletter_consent = http::value("newsletter_consent", "int");
+		if($newsletter_consent !== null) {
+			$nvp["newsletter_consent"] = $newsletter_consent;
+		}
+
 		$level = http::value("level", "int");
 		if($level) {
 			$nvp["level"] = $level;

+ 8 - 0
views/modals/user_export.php

@@ -29,6 +29,14 @@ $level_options = [
 					<label for="export-users-no-tests-after"><?=htmlspecialchars(__("No Test After"))?></label>
 					<input class="form-control" type="date" name="no_tests_after" id="export-users-no-tests-after" placeholder="<?=htmlspecialchars(__("Enter date"))?>" />
 				</div>
+				<div class="form-group">
+					<label for="export-users-newsletter-consent"><?=htmlspecialchars(__("Newsletter Consent"))?></label>
+					<select class="form-control" name="newsletter_consent" id="export-users-newsletter-consent">
+						<option value=""><?=htmlspecialchars(__("Any"))?></option>
+						<option value="1"><?=htmlspecialchars(__("Opted In"))?></option>
+						<option value="0"><?=htmlspecialchars(__("Opted Out"))?></option>
+					</select>
+				</div>
 				
 			</div>
 			<div class="modal-footer">