Version: 1.00, by Gary King
Developer Last Online: Jun 2020
Version: 3.0.0
Rating:
Released: 01-02-2004
Last Update: Never
Installs: 172
No support by the author.
PLEASE CLICK ON THE INSTALL BUTTON IF YOU INSTALLED THIS! THANKS!
What does this hack do?
This hack basically shows the number of new threads and posts since your last visit, in the navbar (under your nick.) Check out the attached screenshot for more information
Installation
This is a pretty simple hack to install.
Instructions are as follows:
FILE MODIFICATIONS
global.php
TEMPLATE MODIFICATIONS
navbar
PHRASES
navbar_sincelastvisit
OPEN global.php AND FIND
PHP Code:
echo "End call of global.php: $aftertime\n";
echo "\n<hr />\n\n";
}
(NOTE: If you want old threads with new posts to count as a new thread, then skip this next step)
UNDER IT, ADD
PHP Code:
# SINCE YOUR LAST VISIT
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM ".TABLE_PREFIX."thread WHERE lastpost > '".$bbuserinfo['lastvisit']."'");
$getnewpost=$DB_site->query_first("SELECT COUNT(*) AS posts FROM ".TABLE_PREFIX."post WHERE dateline > '".$bbuserinfo['lastvisit']."'");
(NOTE: If you did the step above, then skip this next step)
UNDER IT, ADD
PHP Code:
# SINCE YOUR LAST VISIT
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM ".TABLE_PREFIX."thread WHERE dateline > '".$bbuserinfo['lastvisit']."'");
$getnewpost=$DB_site->query_first("SELECT COUNT(*) AS posts FROM ".TABLE_PREFIX."post WHERE dateline > '".$bbuserinfo['lastvisit']."'");
This is what I have put in my globals.php, replacing what the original hack prescribed.
PHP Code:
// #############################################################################
// activity since last visit hack
$forumids = array_keys($forumcache);
foreach($forumids AS $key => $value) {
$fperms = &$bbuserinfo['forumpermissions']["$forumid"];
$forum = &$forumcache["$forumid"];
if (!($fperms & CANVIEW) OR !($fperms & CANSEARCH) OR !verify_forum_password($forumid, $forum['password'], false)) {
unset($forumids["$key"]);
}
}
$getnewthread=$DB_site->query_first("
SELECT COUNT(*) AS threads
FROM " . TABLE_PREFIX . "thread
WHERE lastpost IN(" . implode(', ', $forumids) . ") > '" . $bbuserinfo['lastvisit'] . "'
");
$getnewpost=$DB_site->query_first("
SELECT COUNT(*) AS posts
FROM " . TABLE_PREFIX . "post
WHERE dateline IN(" . implode(', ', $forumids) . ") > '" . $bbuserinfo['lastvisit'] . "'
");
But I got a database error, so... I guess I can't figure it out. I'm used to php, but this is the first experience I've had with vB's scripts. What am I missing?
This is what I have put in my globals.php, replacing what the original hack prescribed.
PHP Code:
// #############################################################################
// activity since last visit hack
$forumids = array_keys($forumcache);
foreach($forumids AS $key => $value) {
$fperms = &$bbuserinfo['forumpermissions']["$forumid"];
$forum = &$forumcache["$forumid"];
if (!($fperms & CANVIEW) OR !($fperms & CANSEARCH) OR !verify_forum_password($forumid, $forum['password'], false)) {
unset($forumids["$key"]);
}
}
$getnewthread=$DB_site->query_first("
SELECT COUNT(*) AS threads
FROM " . TABLE_PREFIX . "thread
WHERE lastpost IN(" . implode(', ', $forumids) . ") > '" . $bbuserinfo['lastvisit'] . "'
");
$getnewpost=$DB_site->query_first("
SELECT COUNT(*) AS posts
FROM " . TABLE_PREFIX . "post
WHERE dateline IN(" . implode(', ', $forumids) . ") > '" . $bbuserinfo['lastvisit'] . "'
");
But I got a database error, so... I guess I can't figure it out. I'm used to php, but this is the first experience I've had with vB's scripts. What am I missing?
What was the database error? If you can't see it, then go to View Source - it's in there
Ah, I had not known that the HTML for the database error page would contain the error comment.
***
Database error in vBulletin 3.0.0 Release Candidate 2:
Invalid SQL:
SELECT COUNT(*) AS threads
FROM thread
WHERE lastpost IN() > '1068258593'
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ') > '1068258593'' at line 3
mysql error number: 1064
***
Character entity. I'll see if I can fix that > crappage.
Ah, I had not known that the HTML for the database error page would contain the error comment.
***
Database error in vBulletin 3.0.0 Release Candidate 2:
Invalid SQL:
SELECT COUNT(*) AS threads
FROM thread
WHERE lastpost IN() > '1068258593'
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ') > '1068258593'' at line 3
mysql error number: 1064
***
Character entity. I'll see if I can fix that > crappage.
Nah it's just like that in HTML, it's supposed to be >.