Log in

View Full Version : Counting methods for new posts don't work


Emeralda
10-24-2011, 07:14 PM
And I'm not sure what's wrong, I tried 3 different things:

I had Cyb's Advanced New Posts installed 3 different times before, but it suddenly stopped working the 4th time. It always shows "New Posts: 0," and on different styles, so that's not it.

I also tried these codes:

https://vborg.vbsupport.ru/showthread.php?t=75539 (inserted it to index.php, since I couldn't find the template, and later $newposts into the template)
//New Posts
$getnewposts = $DB_site->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "post WHERE dateline >= '$bbuserinfo[lastvisit]'");
$newposts = number_format($getnewposts['count']);
//New Posts

Code used on Wordpress
$newposts = $db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "post AS post " . iif($vbulletin->options['threadmarking'], 'LEFT JOIN ' . TABLE_PREFIX . 'threadread AS threadread ON (threadread.threadid = post.threadid AND threadread.userid = ' . $vbulletin->userinfo['userid'] . ')') . " WHERE dateline >= " . $vbulletin->userinfo['lastvisit'] . iif($vbulletin->options['threadmarking'], ' AND dateline > IF(threadread.readtime IS NULL, ' . (TIMENOW - ($vbulletin->options['markinglimit'] * 86400)) . ', threadread.readtime)'));

None of the three options worked (plugin and codes), so maybe it's some setting on the forum that prevents counting up new posts? It did work on the same vB version on the same server before a reinstall.

EDIT: O.O I just notice vb.org also has something like that. How is it done?

Emeralda
10-29-2011, 11:46 AM
Maybe I posted this in the wrong section? I dunno, I'm new here >.<

kh99
10-29-2011, 02:43 PM
I don't think the Wordpress code is going to work n vb. You could try that other code, but you need to change $DB_site to $db or $vbulletin->db.

Emeralda
11-05-2011, 06:20 PM
Nope, it didn't work.

I don't know, maybe it has something to do with not displaying Ajax properly? It doesn't make that much sense, seeing how it worked before on the same server and vB 3.8, but still, I'm quite desperate, and I saw Ajax doesn't always work like intended now. Any ideas how to check that?

kh99
11-08-2011, 11:57 PM
You could try this:

//New Posts
$getnewposts = $vbulletin->db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "post WHERE dateline >= '".$vbulletin->userinfo[lastvisit]."'");
$newposts = number_format($getnewposts['count']);
//New Posts

Emeralda
11-11-2011, 02:58 PM
Hmm, it still didn't work. It might not be the code itself, since I noticed the rainbows script doesn't want to work either. Could it be that a server setting or something is blocking certain scripts? Or doesn't give access to read data?