diff --git a/htdocs/lib2/logic/user.class.php b/htdocs/lib2/logic/user.class.php index 14bbbb3e2..e5ac4085a 100644 --- a/htdocs/lib2/logic/user.class.php +++ b/htdocs/lib2/logic/user.class.php @@ -62,6 +62,7 @@ function __construct($nNewUserId=ID_NEW) $this->reUser->addString('last_name', '', false); $this->reUser->addString('first_name', '', false); $this->reUser->addString('country', null, true); + $this->reUser->addBoolean('accept_mailing', false, false); $this->reUser->addBoolean('pmr_flag', false, false); $this->reUser->addString('new_pw_code', null, true); $this->reUser->addDate('new_pw_date', null, true); @@ -255,6 +256,14 @@ function setPermanentLogin($value) { return $this->reUser->setValue('permanent_login_flag', $value); } + function getAccMailing() + { + return $this->reUser->getValue('accept_mailing'); + } + function setAccMailing($value) + { + return $this->reUser->setValue('accept_mailing', $value); + } function getNoHTMLEditor() { return $this->reUser->getValue('no_htmledit_flag'); @@ -731,7 +740,7 @@ function disable() sql("UPDATE `user` SET `password`=NULL, `email`=NULL, `is_active_flag`=0, `latitude`=0, `longitude`=0, - `last_name`='', `first_name`='', `country`=NULL, `pmr_flag`=0, + `last_name`='', `first_name`='', `country`=NULL, `accept_mailing`=0, `pmr_flag`=0, `new_pw_code`=NULL, `new_pw_date`=NULL, `new_email`=NULL, `new_email_code`=NULL, `new_email_date`=NULL, `email_problems`=0, `first_email_problem`=NULL, `last_email_problem`=NULL, @@ -1296,4 +1305,4 @@ function showStatFounds() return false; } } -?> \ No newline at end of file +?> diff --git a/htdocs/myprofile.php b/htdocs/myprofile.php index 46cec6229..24efc7080 100644 --- a/htdocs/myprofile.php +++ b/htdocs/myprofile.php @@ -128,6 +128,10 @@ function change() } } + $bAccMailing = isset($_REQUEST['save']) ? isset($_REQUEST['accMailing']) : $user->getAccMailing(); + $tpl->assign('accMailing', $bAccMailing); + $user->setAccMailing($bAccMailing); + $bUsePMR = isset($_REQUEST['save']) ? isset($_REQUEST['usePMR']) : $user->getUsePMR(); $tpl->assign('usePMR', $bUsePMR); $user->setUsePMR($bUsePMR); @@ -213,9 +217,11 @@ function assignFromUser($user) $tpl->assign('registeredSince', $user->getDateRegistered()); + $tpl->assign('accMailing', $user->getAccMailing()); + $tpl->assign('usePMR', $user->getUsePMR()); $tpl->assign('permanentLogin', $user->getPermanentLogin()); $tpl->assign('noHTMLEditor', $user->getNoHTMLEditor()); } -?> \ No newline at end of file +?> diff --git a/htdocs/templates2/ocstyle/myprofile.tpl b/htdocs/templates2/ocstyle/myprofile.tpl index 9c6f4845c..15dadeb10 100644 --- a/htdocs/templates2/ocstyle/myprofile.tpl +++ b/htdocs/templates2/ocstyle/myprofile.tpl @@ -136,6 +136,24 @@ + + + {t}Newsletter:{/t} + + {if $edit==true} + + +
+ {else} + {if $accMailing==true} + {t}Yes, I want to recieve mailings about news and actions on opencaching.de. (max. 2-5 per year){/t}
+ {else} + {t}No, I dont't want any mailings about news and actions on opencaching.de.{/t} + {/if} + {/if} + + + {if $edit || $usePMR || $permanentLogin || $noHTMLEditor} diff --git a/htdocs/viewprofile.php b/htdocs/viewprofile.php index 039227a50..f9f9fdcc5 100755 --- a/htdocs/viewprofile.php +++ b/htdocs/viewprofile.php @@ -32,6 +32,7 @@ // user data and basic statistics $rs = sql("SELECT `user`.`username`, `user`.`last_login`, + `user`.`accept_mailing`, `user`.`pmr_flag`, `user`.`date_created`, `user`.`password`, @@ -328,7 +329,8 @@ $tpl->assign('license_actively_declined', $record['data_license'] == NEW_DATA_LICENSE_ACTIVELY_DECLINED); $tpl->assign('license_passively_declined', $record['data_license'] == NEW_DATA_LICENSE_PASSIVELY_DECLINED); + $tpl->assign('accMailing', $record['accept_mailing']); $tpl->assign('pmr', $record['pmr_flag']); $tpl->display(); -?> \ No newline at end of file +?>