prepare('SELECT id FROM services WHERE name = ?'); $p->execute(['Email Newsletters']); $service = $p->fetch(); if (!$service) { die('Email service not found.'); } $service_id = $service['id']; // Check if the user is subscribed to this service $p = db()->prepare('SELECT * FROM user_services WHERE user_id = ? AND service_id = ?'); $p->execute([$user_id, $service_id]); $subscription = $p->fetch(); if (!$subscription) { die('You are not subscribed to this service. Subscribe now'); } ?>
This is where the email newsletter functionality would be.
You could have a list of past newsletters here, or a form to manage your subscription preferences.