Answer the question
In order to leave comments, you need to log in
How to make alerts on the site?
Hello! I make internal notifications on the site (your comment was answered, you were subscribed, you were voted for, etc.).
Everything is stored in the database in this form:
For each action, we add the corresponding entry to the database, for example, your post was liked:
INSERT INTO `events` (`user_id`, `feed_user_id`, `mode`, `mode_id`, `action`) VALUE('2', '1', 'posts', '1255', 'like');
SELECT u.`id`, u.`name`, u.`photo`, p.`id` post_id, p.`title`, e.`action`
FROM `events` e
INNER JOIN `users` u ON u.`id` = e.`user_id`
INNER JOIN `posts` p ON p.`id` = e.`mode_id`
WHERE e.`feed_user_id` = 1 AND e.`mode` = 'posts'
SELECT u.`id`, u.`name`, u.`photo`, e.`action`
FROM `events` e
INNER JOIN `users` u ON u.`id` = e.`user_id`
WHERE e.`feed_user_id` = 1 AND e.`mode` = 'users'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question