mister
11-08-2001, 10:00 PM
New Posts in Subscribed Forums
Originaly Released: 11-09-2001
Last Updated: 11-09-2001
Author: mister
Demo: Sorry, no demo...
Installation Instructions are as follows:
1) Backup your database and all forum files, just in case
2) Add this new template
name: error_not_subscribed
stuff:
You are not subscribed to any forums. This search is only for those who are subscribed to forums. You can subscribe to forums by clicking on the 'Subscribe to this forum' link at the top of each individual forum.
3) Edit search.php as noted below
NOTE: All Additions happen in this if-block: if ($action=="getnew") {
If you put them in the other if's (i.e. newdaily, etc) it won't work properly.
FIND:
if ($action=="getnew") {
// generate query
// do it!
if ($bbuserinfo!=0 or $bbuserinfo[lastvisit]!=0) {
$forumsql=getallforumsql();
[u]AFTER IT, PUT THIS:
//New Subscribed Posts Hack
if ($getsubscribed) {
$subscr_where=getsubscribedforumsql();
if (!$subscr_where) {
eval("standarderror(\"".gettemplate("error_not_subscribed")."\");");
exit;
}
}
//End New Subscribed Posts Hack
IN THAT SAME "getnew" IF-BLOCK FIND:
$wheresql="1=1".$forumsql.$datesql;
$wheresql.=" AND thread.open<>10";
AFTER IT, PUT THIS:
//New Subscribed Posts Hack
if ($getsubscribed) {
$wheresql.=" AND thread.forumid IN ".$subscr_where;
}
//End New Subscribed Posts Hack
PUT THIS SOMEWHERE IN THE FILE:
// ###################### Start get subscribed forum sql #############
function getsubscribedforumsql() {
global $bbuserinfo,$DB_site;
$forums=$DB_site->query("SELECT * FROM forum,subscribeforum WHERE subscribeforum.forumid=forum.forumid AND userid=$bbuserinfo ORDER BY title");
if ($DB_site->num_rows($forums)) {
$ret = '(';
while ($forum=$DB_site->fetch_array($forums)) {
$ret .= $forum[forumid] . ',';
}
$ret = substr($ret,0,strlen($ret)-1);
$ret .= ')';
} else {
$ret = '';
}
return $ret;
}
4) Edit your forumhome_newposts template
[u]Add this
| <a href="search.php?s=$session[sessionhash]&action=getnew&getsubscribed=1">View New Subscribed Posts</a>
5) Enjoy!
Originaly Released: 11-09-2001
Last Updated: 11-09-2001
Author: mister
Demo: Sorry, no demo...
Installation Instructions are as follows:
1) Backup your database and all forum files, just in case
2) Add this new template
name: error_not_subscribed
stuff:
You are not subscribed to any forums. This search is only for those who are subscribed to forums. You can subscribe to forums by clicking on the 'Subscribe to this forum' link at the top of each individual forum.
3) Edit search.php as noted below
NOTE: All Additions happen in this if-block: if ($action=="getnew") {
If you put them in the other if's (i.e. newdaily, etc) it won't work properly.
FIND:
if ($action=="getnew") {
// generate query
// do it!
if ($bbuserinfo!=0 or $bbuserinfo[lastvisit]!=0) {
$forumsql=getallforumsql();
[u]AFTER IT, PUT THIS:
//New Subscribed Posts Hack
if ($getsubscribed) {
$subscr_where=getsubscribedforumsql();
if (!$subscr_where) {
eval("standarderror(\"".gettemplate("error_not_subscribed")."\");");
exit;
}
}
//End New Subscribed Posts Hack
IN THAT SAME "getnew" IF-BLOCK FIND:
$wheresql="1=1".$forumsql.$datesql;
$wheresql.=" AND thread.open<>10";
AFTER IT, PUT THIS:
//New Subscribed Posts Hack
if ($getsubscribed) {
$wheresql.=" AND thread.forumid IN ".$subscr_where;
}
//End New Subscribed Posts Hack
PUT THIS SOMEWHERE IN THE FILE:
// ###################### Start get subscribed forum sql #############
function getsubscribedforumsql() {
global $bbuserinfo,$DB_site;
$forums=$DB_site->query("SELECT * FROM forum,subscribeforum WHERE subscribeforum.forumid=forum.forumid AND userid=$bbuserinfo ORDER BY title");
if ($DB_site->num_rows($forums)) {
$ret = '(';
while ($forum=$DB_site->fetch_array($forums)) {
$ret .= $forum[forumid] . ',';
}
$ret = substr($ret,0,strlen($ret)-1);
$ret .= ')';
} else {
$ret = '';
}
return $ret;
}
4) Edit your forumhome_newposts template
[u]Add this
| <a href="search.php?s=$session[sessionhash]&action=getnew&getsubscribed=1">View New Subscribed Posts</a>
5) Enjoy!