$sql = "SELECT notify_status FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id = " . $topic_id . " AND user_id = " . $user->data['user_id'] . " LIMIT 1"; $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) { if (!empty($unwatch)) { if ($unwatch == 'topic') { $is_watching_topic = false; $class_notifications->delete_topic_watch($user->data['user_id'], $topic_id); } $redirect_url = append_sid(CMS_PAGE_VIEWTOPIC . '?' . $forum_id_append . '&' . $topic_id_append . '&start=' . $start . $kb_mode_append); meta_refresh(3, $redirect_url); $message = $lang['No_longer_watching'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid(CMS_PAGE_VIEWTOPIC . '?' . $forum_id_append . '&' . $topic_id_append . '&start=' . $start . $kb_mode_append) . '">', '</a>'); message_die(GENERAL_MESSAGE, $message); } else { $is_watching_topic = true; if ($row['notify_status']) { $class_notifications->update_topic_watch($user->data['user_id'], $topic_id, $forum_id, 0);