Only show dismissed notifications pertaining to the logged in user

This commit is contained in:
johnnyq 2024-11-17 15:09:30 -05:00
parent a81bcf350c
commit cf6df1c2b1
1 changed files with 4 additions and 15 deletions

View File

@ -6,7 +6,6 @@ $order = "DESC";
require_once "inc_all.php";
//Rebuild URL
$url_query_strings_sort = http_build_query($get_copy);
@ -14,11 +13,10 @@ $url_query_strings_sort = http_build_query($get_copy);
$sql = mysqli_query(
$mysqli,
"SELECT SQL_CALC_FOUND_ROWS * FROM notifications
LEFT JOIN users ON notification_dismissed_by = user_id
LEFT JOIN clients ON notification_client_id = client_id
WHERE (notification_type LIKE '%$q%' OR notification LIKE '%$q%' OR user_name LIKE '%$q%' OR client_name LIKE '%$q%')
WHERE (notification_type LIKE '%$q%' OR notification LIKE '%$q%' OR client_name LIKE '%$q%')
AND DATE(notification_timestamp) BETWEEN '$dtf' AND '$dtt'
AND (notification_user_id = $session_user_id OR notification_user_id = 0)
AND notification_user_id = $session_user_id
AND notification_dismissed_at IS NOT NULL
ORDER BY $sort $order
LIMIT $record_from, $record_to
@ -93,11 +91,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
Dismissed At <?php if ($sort == 'notification_dismissed_at') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_name&order=<?php echo $disp; ?>">
Dismissed By <?php if ($sort == 'user_name') { echo $order_icon; } ?>
</a>
</th>
</tr>
</thead>
<tbody>
@ -109,7 +102,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
$notification_type = nullable_htmlentities($row['notification_type']);
$notification = nullable_htmlentities($row['notification']);
$notification_dismissed_at = nullable_htmlentities($row['notification_dismissed_at']);
$user_name = nullable_htmlentities($row['user_name']);
$client_name = nullable_htmlentities($row['client_name']);
$client_id = intval($row['client_id']);
if (empty($client_name)) {
@ -125,19 +117,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<td><?php echo $notification; ?></td>
<td><?php echo $client_name_display; ?></td>
<td><?php echo $notification_dismissed_at; ?></td>
<td><?php echo $user_name; ?></td>
<?php } ?>
</tbody>
</table>
</div>
<?php require_once "pagination.php";
?>
<?php require_once "pagination.php"; ?>
</div>
</div>
<?php
require_once "footer.php";
require_once "footer.php";