Skip to content

Commit

Permalink
Remove emailpublic field.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Jul 5, 2018
1 parent 11bde42 commit aa83acd
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 65 deletions.
2 changes: 0 additions & 2 deletions classes/FacebookLogin.php
Expand Up @@ -129,7 +129,6 @@ public function createUser($accessToken, $user) {
'status' => '',
'password' => '',
'optin' => False,
'emailpublic' => False,
'mp_alert' => False,
'facebook_id' => $user['id']
);
Expand All @@ -156,7 +155,6 @@ public function updateUser($user) {
'postcode' => $THEUSER->postcode(),
'url' => $THEUSER->url(),
'optin' => $THEUSER->optin(),
'emailpublic' => False,
'password' => '',
);

Expand Down
3 changes: 0 additions & 3 deletions classes/User.php
Expand Up @@ -31,7 +31,6 @@ public function getUserDetails($user_id = False) {
$data['name'] = $user->firstname() . " " . $user->lastname();
$data['url'] = $user->url();
$data['email'] = $user->email();
$data['emailpublic'] = $user->emailpublic() == true ? "Yes" : "No";
$data['optin'] = $user->optin() == true ? "Yes" : "No";
$data['postcode'] = $user->postcode();
$data['website'] = $user->url();
Expand Down Expand Up @@ -61,15 +60,13 @@ public function getUpdateDetails($this_page, $user) {
if ($user->facebook_user) {
$details = $this->getUserDetails();
$details["password"] = '';
$details["emailpublic"] = false;
} else {
$details["firstname"] = trim(get_http_var("firstname"));
$details["lastname"] = trim(get_http_var("lastname"));

$details["password"] = trim(get_http_var("password"));
$details["password2"] = trim(get_http_var("password2"));

$details["emailpublic"] = get_http_var("emailpublic") == "true" ? true : false;
$details["email"] = trim(get_http_var("em"));

$details["url"] = trim(get_http_var("url"));
Expand Down
3 changes: 0 additions & 3 deletions tests/UserTest.php
Expand Up @@ -31,7 +31,6 @@ public function testAddUser() {
"firstname" => 'Test',
"lastname" => 'User',
"email" => 'test@example.org',
"emailpublic" => '0',
"postcode" => 'EH1 99SP',
"mp_alert" => false,
"url" => '',
Expand All @@ -58,7 +57,6 @@ public function testEditUser() {
$d = $u->update_self( array(
'firstname' => 'Experiment',
'lastname' => 'User',
'emailpublic' => '0',
'postcode' => 'EH1 99SP',
'password' => '',
'url' => '',
Expand All @@ -80,7 +78,6 @@ public function testEditUserEmail() {
'firstname' => 'Experiment',
'lastname' => 'User',
'email' => 'user@example.com',
'emailpublic' => '0',
'postcode' => 'EH1 99SP',
'password' => '',
'url' => '',
Expand Down
15 changes: 0 additions & 15 deletions www/includes/easyparliament/templates/html/user/form.php
Expand Up @@ -131,21 +131,6 @@
<span class="formw"><input type="text" name="url" id="url" value="<?= _htmlentities($url) ?>" maxlength="255" size="20" class="form"> <small>Optional and public</small></span>
</div>

<?php if (isset($errors['emailpublic'])) { ?>
<p class="error">
<?= $errors['emailpublic'] ?>
</p>
<?php } ?>

<div class="row">
&nbsp;<br>Let other users see your email address?
</div>

<div class="row">
<span class="formw"><input type="radio" name="emailpublic" id="emailpublictrue" value="true" <?= $emailpublic == 'Yes' ? ' checked' : '' ?>> <label for="emailpublictrue">Yes</label><br>
<input type="radio" name="emailpublic" id="emailpublicfalse" value="false" <?= $emailpublic == 'No' ? ' checked' : '' ?>> <label for="emailpublicfalse">No</label></span>
</div>

<?php if (isset($showall) && $showall == True) { ?>
<?php if (isset($errors['status'])) { ?>
<p class="error">
Expand Down
7 changes: 1 addition & 6 deletions www/includes/easyparliament/templates/html/user/index.php
Expand Up @@ -35,14 +35,9 @@
<span class="formw"><?= _htmlentities($name) ?></span>
</div>

<div class="row">
<span class="label">Email</span>
<span class="formw"><?= $emailpublic == 'Yes' ? _htmlentities($email) : 'Not public' ?></span>
</div>

<div class="row">
<span class="label">Website</span>
<span class="formw"><?= $website == '' ? 'none' : '<a href="' . _htmlentities($website) . '">'. _htmlentities($website) . '</a>' ?></span>
<span class="formw"><?= $website == '' ? 'none' : '<a rel="nofollow" href="' . _htmlentities($website) . '">'. _htmlentities($website) . '</a>' ?></span>
</div>

<?php if ($facebook_user) { ?>
Expand Down
15 changes: 0 additions & 15 deletions www/includes/easyparliament/templates/html/user/join.php
Expand Up @@ -95,21 +95,6 @@
<span class="formw"><input type="text" name="url" id="url" value="<?= isset($url) ? _htmlentities($url) : '' ?>" maxlength="255" size="20" class="form"> <small>Optional and public</small></span>
</div>

<?php if (isset($errors['emailpublic'])) { ?>
<p class="error">
<?= $errors['emailpublic'] ?>
</p>
<?php } ?>

<div class="row">
&nbsp;<br>Let other users see your email address?
</div>

<div class="row">
<span class="formw"><input type="radio" name="emailpublic" id="emailpublictrue" value="true" <?= isset($emailpublic) && $emailpublic == 'Yes' ? ' checked' : '' ?>> <label for="emailpublictrue">Yes</label><br>
<input type="radio" name="emailpublic" id="emailpublicfalse" value="false" <?= isset($emailpublic) && $emailpublic == 'No' ? ' checked' : !isset($emailpublic) ? ' checked' : '' ?>> <label for="emailpublicfalse">No</label></span>
</div>

<div class="row">
&nbsp;<br>Do you wish to receive occasional update emails about TheyWorkForYou.com?
</div>
Expand Down
Expand Up @@ -6,14 +6,9 @@
<span class="formw"><?= _htmlentities($name) ?></span>
</div>

<div class="row">
<span class="label">Email</span>
<span class="formw"><?= $emailpublic == 'Yes' ? _htmlentities($email) : 'Not public' ?></span>
</div>

<div class="row">
<span class="label">Website</span>
<span class="formw"><?= $website == '' ? 'none' : '<a href="' . _htmlentities($website) . '">'. _htmlentities($website) . '</a>' ?></span>
<span class="formw"><?= $website == '' ? 'none' : '<a rel="nofollow" href="' . _htmlentities($website) . '">'. _htmlentities($website) . '</a>' ?></span>
</div>

<div class="row">
Expand Down
15 changes: 0 additions & 15 deletions www/includes/easyparliament/user.php
Expand Up @@ -61,7 +61,6 @@ class USER {
public $lastname = "";
public $password = ""; // This will be a hashed version of a plaintext pw.
public $email = "";
public $emailpublic = ""; // boolean - can other users see this user's email?
public $postcode = "";
public $url = "";
public $lastvisit = ""; // Last time the logged-in user loaded a page (GMT).
Expand Down Expand Up @@ -96,7 +95,6 @@ public function init($user_id) {
lastname,
password,
email,
emailpublic,
postcode,
url,
lastvisit,
Expand All @@ -122,7 +120,6 @@ public function init($user_id) {
$this->lastname = $q->field(0,"lastname");
$this->password = $q->field(0,"password");
$this->email = $q->field(0,"email");
$this->emailpublic = $q->field(0,"emailpublic") == 1 ? true : false;
$this->postcode = $q->field(0,"postcode");
$this->facebook_id = $q->field(0,"facebook_id");
$this->facebook_token = $q->field(0,"facebook_token");
Expand Down Expand Up @@ -181,13 +178,10 @@ public function add($details, $confirmation_required=true) {

$optin = $details["optin"] == true ? 1 : 0;

$emailpublic = $details["emailpublic"] == true ? 1 : 0;

$q = $this->db->query("INSERT INTO users (
firstname,
lastname,
email,
emailpublic,
postcode,
url,
password,
Expand All @@ -201,7 +195,6 @@ public function add($details, $confirmation_required=true) {
:firstname,
:lastname,
:email,
:emailpublic,
:postcode,
:url,
:password,
Expand All @@ -216,7 +209,6 @@ public function add($details, $confirmation_required=true) {
':firstname' => $details["firstname"],
':lastname' => $details["lastname"],
':email' => $details["email"],
':emailpublic' => $emailpublic,
':postcode' => $details["postcode"],
':url' => $details["url"],
':password' => $passwordforDB,
Expand Down Expand Up @@ -680,7 +672,6 @@ public function firstname() { return $this->firstname; }
public function lastname() { return $this->lastname; }
public function password() { return $this->password; }
public function email() { return $this->email; }
public function emailpublic() { return $this->emailpublic; }
public function postcode() { return $this->postcode; }
public function url() { return $this->url; }
public function lastvisit() { return $this->lastvisit; }
Expand Down Expand Up @@ -791,13 +782,11 @@ public function _update($details) {
}

// Convert internal true/false variables to MySQL BOOL 1/0 variables.
$emailpublic = $details["emailpublic"] == true ? 1 : 0;
$optin = $details["optin"] == true ? 1 : 0;

$q = $this->db->query("UPDATE users
SET firstname = :firstname,
lastname = :lastname,
emailpublic = :emailpublic,
postcode = :postcode,
url = :url,"
. $passwordsql
Expand All @@ -810,7 +799,6 @@ public function _update($details) {
", array_merge($params, array(
':firstname' => $details['firstname'],
':lastname' => $details['lastname'],
':emailpublic' => $emailpublic,
':postcode' => $details['postcode'],
':url' => $details['url'],
':optin' => $optin,
Expand Down Expand Up @@ -1218,7 +1206,6 @@ public function confirm_email($token, $redirect=true) {
'url' => $this->url(),
'optin' => $this->optin(),
'user_id' => $user_id,
'emailpublic' => $this->emailpublic()
);
$ret = $this->_update($details);

Expand Down Expand Up @@ -1423,7 +1410,6 @@ public function update_self_no_confirm($details) {

$this->firstname = $newdetails["firstname"];
$this->lastname = $newdetails["lastname"];
$this->emailpublic = $newdetails["emailpublic"];
$this->postcode = $newdetails["postcode"];
$this->url = $newdetails["url"];
$this->optin = $newdetails["optin"];
Expand Down Expand Up @@ -1477,7 +1463,6 @@ public function update_self($details, $confirm_email = true) {

$this->firstname = $newdetails["firstname"];
$this->lastname = $newdetails["lastname"];
$this->emailpublic = $newdetails["emailpublic"];
$this->postcode = $newdetails["postcode"];
$this->url = $newdetails["url"];
$this->optin = $newdetails["optin"];
Expand Down

0 comments on commit aa83acd

Please sign in to comment.