Commit da106592 authored by Clare Lenihan's avatar Clare Lenihan Committed by Clare Lenihan
Browse files

Subscribing to a forum now unsubscribes from all topics in that forum

Previously, unsubscribing to a forum unsubscribed from all topics in that forum
parent 8e479d9f
......@@ -93,21 +93,22 @@ function subscribe_submit(Pieform $form, $values) {
'user' => $USER->get('id')
)
);
}
else {
delete_records(
'interaction_forum_subscription_forum',
'forum', $values['forum'],
'user', $USER->get('id')
);
delete_records_sql(
'DELETE FROM {interaction_forum_subscription_topic}
WHERE topic IN (
SELECT id
FROM {interaction_forum_topic}
WHERE forum = ?
AND "user" = ?
)',
array($values['forum'])
array($values['forum'], $USER->get('id'))
);
}
else {
delete_records(
'interaction_forum_subscription_forum',
'forum', $values['forum'],
'user', $USER->get('id')
);
}
redirect('/interaction/forum/index.php?group=' . $groupid);
......
......@@ -178,21 +178,22 @@ function subscribe_forum_submit(Pieform $form, $values) {
'user' => $USER->get('id')
)
);
}
else {
delete_records(
'interaction_forum_subscription_forum',
'forum', $forumid,
'user', $USER->get('id')
);
delete_records_sql(
'DELETE FROM {interaction_forum_subscription_topic}
WHERE topic IN (
SELECT id
FROM {interaction_forum_topic}
WHERE forum = ?
AND "user" = ?
)',
array($forumid)
array($forumid, $USER->get('id'))
);
}
else {
delete_records(
'interaction_forum_subscription_forum',
'forum', $forumid,
'user', $USER->get('id')
);
}
redirect('/interaction/forum/view.php?id=' . $forumid . '&offset=' . $offset);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment