PDA

View Full Version : New Posts in Subscribed Forums


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!

LuBi
11-14-2001, 04:08 AM
So what's this do? Search thread your subsribed to..? How do I select which forum to search..? no demo or ss... sounds great but I need more info I'll be sure to install..

Admin
11-14-2001, 09:50 AM
LuBi, it just shows you all threads you are subscribed to that have new posts in them.
Like the "View New Posts" search, only this only returns subscribed threads.

mister, I think you forgot a function you wrote, getsubscribedforumsql(). :)

LuBi
11-14-2001, 05:50 PM
LuBi, it just shows you all threads you are subscribed to that have new posts in them.

All the time when you search or is it selectable?

Admin
11-14-2001, 06:07 PM
[QUOTE]Originally posted by LuBi
All the time when you search or is it selectable?

red_baron2000
04-05-2003, 06:30 AM
anyone mind finishing this ?
please :)

mister
04-05-2003, 05:03 PM
Sorry about forgetting to add that one function.
My bad. Thanks for reminding me, red_barron2000.

Should work now once you add that function to search.php

Boofo
04-05-2003, 05:18 PM
I'm getting this error after adding the function.

Parse error: parse error, unexpected ',' in /home/bear/public_html/forum/search.php on line 578

It has to do with this line.

$ret = $ret,0,$ret)-1);

red_baron2000
04-05-2003, 07:46 PM
Today at 07:18 PM Boofo said this in Post #8 (https://vborg.vbsupport.ru/showthread.php?postid=377928#post377928)
I'm getting this error after adding the function.

Parse error: parse error, unexpected ',' in /home/bear/public_html/forum/search.php on line 578

It has to do with this line.

$ret = $ret,0,$ret)-1);


same here :confused: