Current time: 05-24-2012, 11:30 PM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 3 Votes - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] Make spider thread views not count
06-12-2011, 03:40 AM (This post was last modified: 02-08-2012 09:19 PM by Nathan Malcolm.)
Post: #1
[Tutorial] Make spider thread views not count
I have seen it in many forums, even here on MyBB.com, that thread views pile up because of heavy spider traffic.

I don't see the point on these counting, as they aren't legit views. Here's the very simple way to prevent this happening.

Open showthread.php with a text editor, find:

Code:
if($mybb->settings['delayedthreadviews'] == 1)
{
$db->shutdown_query("INSERT INTO ".TABLE_PREFIX."threadviews (tid) VALUES('{$tid}')");
}
else
{
$db->shutdown_query("UPDATE ".TABLE_PREFIX."threads SET views=views+1 WHERE tid='{$tid}'");
}

and replace with:

Code:
if($mybb->settings['delayedthreadviews'] == 1 && $session->is_spider == false)
{
$db->shutdown_query("INSERT INTO ".TABLE_PREFIX."threadviews (tid) VALUES('{$tid}')");
}
elseif($session->is_spider == false)
{
$db->shutdown_query("UPDATE ".TABLE_PREFIX."threads SET views=views+1 WHERE tid='{$tid}'");
}

Thanks for reading.

-Nathan Malcolm
[Image: 1Zy5naW.gif] Quality Assurance Team

MyBB Security — MyBB Security & Support Forum
Visit this user's website Find all posts by this user
Quote this message in a reply
02-08-2012, 09:17 PM
Post: #2
RE: [Tutorial] Make spider thread views not count
Very cool. Smile
Find all posts by this user
Quote this message in a reply
02-09-2012, 05:22 AM
Post: #3
RE: [Tutorial] Make spider thread views not count
Hmmm. I might need to do this in the next couple of days.
*places in list of things to do*

[Image: logo.png]
(04-05-2012 07:42 AM)Tomm M Wrote:  As for the second, can you explain in a bit more detail? I have no idea what 'Haddvha' is.
Visit this user's website Find all posts by this user
Quote this message in a reply
02-09-2012, 07:49 AM
Post: #4
RE: [Tutorial] Make spider thread views not count
Thanks for this.

Custom Theme Creation Service
My Latest Plugins: Post Count Message | Group Message | Logo Expiration
Visit this user's website Find all posts by this user
Quote this message in a reply
02-09-2012, 04:33 PM
Post: #5
RE: [Tutorial] Make spider thread views not count
Actually, I think this modification should be core, if it isn't already planned.

[Image: logo.png]
(04-05-2012 07:42 AM)Tomm M Wrote:  As for the second, can you explain in a bit more detail? I have no idea what 'Haddvha' is.
Visit this user's website Find all posts by this user
Quote this message in a reply
02-10-2012, 12:01 AM
Post: #6
RE: [Tutorial] Make spider thread views not count
(02-09-2012 04:33 PM)GamerVoid Wrote:  Actually, I think this modification should be core, if it isn't already planned.

[Image: dedeno_fullheader1.png] - My website
- Writing tutorials
- Fun anime discussions
- Direct support
- New lessons by request
Visit this user's website Find all posts by this user
Quote this message in a reply
02-10-2012, 07:07 AM
Post: #7
RE: [Tutorial] Make spider thread views not count
This user has been denied support. This user has been denied support.
I made a plugin for this some time back, forgot to release, would do soon.

My Plugins & Themes
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | MyBB | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication