Skip to content

Commit

Permalink
Allowing subscribers to be filtered by confirmed and/or blacklisted (#…
Browse files Browse the repository at this point in the history
…1030)

* Update users.php

Allowed to filter by confirmed and/or non blacklisted - and not just by unconfirmed and/or blacklisted

* Changed users to subscribers
  • Loading branch information
lwcorp authored Mar 28, 2024
1 parent 61e952c commit a9ea8d7
Showing 1 changed file with 48 additions and 6 deletions.
54 changes: 48 additions & 6 deletions public_html/lists/admin/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
}
$unconfirmed = !empty($_GET['unconfirmed']) ? sprintf('%d', $_GET['unconfirmed']) : 0;
$blacklisted = !empty($_GET['blacklisted']) ? sprintf('%d', $_GET['blacklisted']) : 0;
$confirmed = !empty($_GET['confirmed']) ? sprintf('%d', $_GET['confirmed']) : 0;
$nonblacklisted = !empty($_GET['nonblacklisted']) ? sprintf('%d', $_GET['nonblacklisted']) : 0;
if (isset($_GET['sortorder'])) {
if ($_GET['sortorder'] == 'asc') {
$sortorder = 'asc';
Expand Down Expand Up @@ -147,10 +149,15 @@
$subselect = "{$tables['user']}.id = {$tables['listuser']}.userid and {$tables['listuser']}.listid = {$tables['list']}.id and {$tables['list']}.owner = ".$_SESSION['logindetails']['id'];
if ($unconfirmed) {
$subselect .= ' and !confirmed ';
} elseif ($confirmed) {
$subselect .= ' and confirmed ';
}
if ($blacklisted) {
$subselect .= ' and blacklisted ';
} elseif ($nonblacklisted) {
$subselect .= ' and !blacklisted ';
}

if ($find && $findbyselect) {
$listquery = "select DISTINCT {$tables['user']}.email,{$tables['user']}.id,$findfield,confirmed from ".$table_list." where $subselect and $findbyselect";
$count = Sql_query("SELECT count(distinct {$tables['user']}.id) FROM ".$table_list." where $subselect and $findbyselect");
Expand All @@ -167,9 +174,13 @@
if ($find && $findbyselect) {
if ($unconfirmed) {
$findbyselect .= ' and !confirmed ';
} elseif ($confirmed) {
$findbyselect .= ' and confirmed ';
}
if ($blacklisted) {
$findbyselect .= ' and blacklisted ';
} elseif ($nonblacklisted) {
$findbyselect .= ' and !blacklisted ';
}
$listquery = "select DISTINCT {$tables['user']}.email,{$tables['user']}.id,$findfield,{$tables['user']}.confirmed from ".$table_list." where $findbyselect";
$count = Sql_query('SELECT count(*) FROM '.$table_list." where $findbyselect");
Expand All @@ -195,21 +206,35 @@
if ($find && $findbyselect) {
if ($unconfirmed) {
$findbyselect .= ' and !confirmed ';
} elseif ($confirmed) {
$findbyselect .= ' and confirmed ';
}
if ($blacklisted) {
$findbyselect .= ' and blacklisted ';
} elseif ($nonblacklisted) {
$findbyselect .= ' and !blacklisted ';
}
$listquery = "select {$tables['user']}.email,{$tables['user']}.id,$findfield,{$tables['user']}.confirmed from ".$table_list." where $findbyselect";
$count = Sql_query('SELECT count(*) FROM '.$table_list." where $findbyselect");
$unconfirmedcount = Sql_query('SELECT count(*) FROM '.$table_list." where !confirmed and $findbyselect");
} else {
$subselect = '';
if ($unconfirmed || $blacklisted) {
if ($unconfirmed || $blacklisted || $confirmed || $nonblacklisted) {
$subselect = ' where ';
if ($unconfirmed && $blacklisted) {
$subselect .= ' !confirmed and blacklisted ';
} elseif ($confirmed && $nonblacklisted) {
$subselect .= ' confirmed and !blacklisted ';
} elseif ($unconfirmed && $nonblacklisted) {
$subselect .= ' !confirmed and !blacklisted ';
} elseif ($confirmed && $blacklisted) {
$subselect .= ' confirmed and blacklisted ';
} elseif ($unconfirmed) {
$subselect .= ' !confirmed ';
} elseif ($confirmed) {
$subselect .= ' confirmed ';
} elseif ($nonblacklisted) {
$subselect .= ' !blacklisted ';
} else {
$subselect .= ' blacklisted';
}
Expand Down Expand Up @@ -280,6 +305,16 @@
} else {
$bll = '';
}
if ($confirmed) {
$nonunc = 'checked="checked"';
} else {
$nonunc = '';
}
if ($nonblacklisted) {
$nonbll = 'checked="checked"';
} else {
$nonbll = '';
}
if (!isset($start)) {
$start = 0;
}
Expand All @@ -290,15 +325,22 @@
<input type="hidden" name="start" value="%d" />
<input type="hidden" name="find" value="%s" />
<input type="hidden" name="findby" value="%s" />
<label for="unconfirmed">%s:<input type="checkbox" name="unconfirmed" value="1" %s /></label>
<label for="blacklisted">%s:<input type="checkbox" name="blacklisted" value="1" %s /></label>',
<label for="unconfirmed">%s:<input onclick="if (this.checked && form.confirmed.checked) form.confirmed.checked=false" type="checkbox" name="unconfirmed" value="1" %s /></label>
<label for="blacklisted">%s:<input onclick="if (this.checked && form.nonblacklisted.checked) form.nonblacklisted.checked=false" type="checkbox" name="blacklisted" value="1" %s /></label>
<div class="clearfix"></div>
<label for="confirmed">%s:<input onclick="if (this.checked && form.unconfirmed.checked) form.unconfirmed.checked=false" type="checkbox" name="confirmed" value="1" %s /></label>
<label for="backlisted">%s:<input onclick="if (this.checked && form.blacklisted.checked) form.blacklisted.checked=false"type="checkbox" name="nonblacklisted" value="1" %s /></label>',
$start,
htmlspecialchars(stripslashes($find)),
htmlspecialchars(stripslashes($findby)),
$GLOBALS['I18N']->get('Show only unconfirmed users'),
$GLOBALS['I18N']->get('Show only unconfirmed subscribers'),
$unc,
$GLOBALS['I18N']->get('Show only blacklisted users'),
$bll);
$GLOBALS['I18N']->get('Show only blacklisted subscribers'),
$bll,
$GLOBALS['I18N']->get('Show only confirmed subscribers'),
$nonunc,
$GLOBALS['I18N']->get('Show only non blacklisted subscribers'),
$nonbll);
//print '</td><td valign="top">';
$select = '';
foreach (array(
Expand Down

0 comments on commit a9ea8d7

Please sign in to comment.