Skip to content

Commit

Permalink
328: useroption for mailings
Browse files Browse the repository at this point in the history
  • Loading branch information
Schrottie authored and bohrsty committed Jan 11, 2014
1 parent c297bbc commit 67ddf1a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
13 changes: 11 additions & 2 deletions htdocs/lib2/logic/user.class.php
Expand Up @@ -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);
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -1296,4 +1305,4 @@ function showStatFounds()
return false;
}
}
?>
?>
8 changes: 7 additions & 1 deletion htdocs/myprofile.php
Expand Up @@ -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);
Expand Down Expand Up @@ -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());
}

?>
?>
18 changes: 18 additions & 0 deletions htdocs/templates2/ocstyle/myprofile.tpl
Expand Up @@ -136,6 +136,24 @@
</td>
</tr>
<tr><td class="spacer" colspan="2"></td></tr>

<tr>
<td valign="top">{t}Newsletter:{/t}</td>
<td valign="top">
{if $edit==true}
<input type="checkbox" name="accMailing" value="1" {if $accMailing==true}checked="checked"{/if} id="acc_Mailing" class="checkbox" />
<label for="acc_Mailing">{t}Please send me mailings about news and actions on opencaching.de. (max. 2-5 per year){/t}</label>
<br />
{else}
{if $accMailing==true}
{t}Yes, I want to recieve mailings about news and actions on opencaching.de. (max. 2-5 per year){/t}<br />
{else}
{t}No, I dont't want any mailings about news and actions on opencaching.de.{/t}
{/if}
{/if}
</td>
</tr>
<tr><td class="spacer" colspan="2"></td></tr>

{if $edit || $usePMR || $permanentLogin || $noHTMLEditor}
<tr>
Expand Down
4 changes: 3 additions & 1 deletion htdocs/viewprofile.php
Expand Up @@ -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`,
Expand Down Expand Up @@ -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();
?>
?>

0 comments on commit 67ddf1a

Please sign in to comment.