OK, so I tried out my plan and I think it's almost working except that I'm getting an "unable to fetch subscription info' error. This would be a db problem, right?
Here's what I did:
viewforum.php: (around line 239 or so)
<!--SUBSCRIBE FORUM MOD-->
<?php
if (!$cookie['is_guest'] && $pun_config['o_subscriptions'] == '1')
{
if ($is_subscribed)
// I apologize for the variable naming here. It's a mix of subscription and action I guess :-)
$subscraction = $lang_forum['Is subscribed'].' - <a href="misc.php?unsubscribe_forum='.$id.'">'.$lang_forum['Unsubscribe'].'</a>';
else
$subscraction = '<a href="misc.php?subscribe_forum='.$id.'">'.$lang_forum['Subscribe'].'</a>';
}
else
$subscraction = ' ';
?>
<!-- END SUBSCRIBE FORUM MOD-->
<table class="punspacer" cellspacing="1" cellpadding="4">
<tr>
<td style="width: 46%"><?php echo $lang_common['Pages'].': '.paginate($num_pages, $p, 'viewforum.php?id='.$id) ?></td>
<!--SUBSCRIBE FORUM MOD-->
<td class="punright" style="width: 35%"><?php echo $subscraction ?></td>
<!--END SUBSCRIBE FORUM MOD-->
<td class="punright" style="width: 19%"><b><?php echo $post_link ?></b></td>
</tr>
</table>
misc.php: (line 288 or so)
// SUBSCRIBE FORUM MOD
else if (isset($_GET['subscribe_forum']))
{
$forum_id = intval($_GET['subscribe_forum']);
if (empty($forum_id))
message($lang_common['Bad request']);
if ($cookie['is_guest'])
message($lang_common['No permission']);
$result = $db->query('SELECT 1 FROM '.$db->prefix.'subscriptions_forums WHERE user_id='.$cur_user['id'].' AND forum_id='.$forum_id) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
message($lang_misc['Already subscribed_f']);
$db->query('INSERT INTO '.$db->prefix.'subscriptions_forums (user_id, forum_id) VALUES('.$cur_user['id'].' ,'.$forum_id.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error());
redirect('viewforum.php?id='.$forum_id, $lang_misc['Subscribe redirect']);
}
else if (isset($_GET['unsubscribe_forum']))
{
$forum_id = intval($_GET['unsubscribe_forum']);
if (empty($forum_id))
message($lang_common['Bad request']);
if ($cookie['is_guest'])
message($lang_common['No permission']);
$result = $db->query('SELECT 1 FROM '.$db->prefix.'subscriptions_forums WHERE user_id='.$cur_user['id'].' AND forum_id='.$forum_id) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_misc['Not subscribed_f']);
$db->query('DELETE FROM '.$db->prefix.'subscriptions_forums WHERE user_id='.$cur_user['id'].' AND forum_id='.$forum_id) or error('Unable to remove subscription', __FILE__, __LINE__, $db->error());
redirect('viewforum.php?id='.$forum_id, $lang_misc['Unsubscribe redirect']);
}
// end SUBSCRIBE FORUM MOD
I also made changes to the forum and misc lang files but they don't seem to causing problems...
EDIT: I checked the db and noticed that there is no 'forum_id' field in the 'subscriptions' table... If I just add this field will my problems be solved?
EDIT2: OK so I added the field to the db and now get no errors... but the mail doesn't go through.... not really surprising since I didn't change any mailing stuff... next? Also, viewforum.php isn't recognizing me as subscribed so is showing the 'subscribe to this forum' link but when I click it it says I'm already subscribed -- I'm guessing that '$is_subscribed' isn't set but I don't know how to do that.
EDIT3!!: updated code boxes to reflect current status.
Any help would be appreciated.... my MySQL knowledge is minimal...
Find what you want... Where you want it...
www.truelocal.com