[MODDB] Prevent Topic View Increase by Author 1.0.0

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Scam Warning
cuteprincess2k
Registered User
Posts: 47
Joined: Sun Mar 16, 2008 8:28 pm

Re: [Beta] Stop Author View Increase 0.0.2

Post by cuteprincess2k » Fri Jun 06, 2008 3:27 am

Download link is dead. Can someone please re upload the zip file ..

Thanks

BondGamer
Registered User
Posts: 435
Joined: Mon Dec 15, 2003 7:49 pm
Contact:

Re: [Beta] Stop Author View Increase 0.0.2

Post by BondGamer » Fri Jun 06, 2008 3:53 am

I've put up a new download link in the original post.

I have thought up a new feature for this. Would anyone be interested in this be made into a MOD where you could specify specific forums that the author is prevented from increasing view count? I can't think of any situation where this would be useful or why someone would want it. But I could make it if someone has a good reason or needs it.
My phpBB3 Mods: - None active =[

cuteprincess2k
Registered User
Posts: 47
Joined: Sun Mar 16, 2008 8:28 pm

Re: [Beta] Stop Author View Increase 0.0.2

Post by cuteprincess2k » Fri Jun 06, 2008 6:44 am

I did as per instruction in the txt file . But the topic view counter increases when the topic poster "views" the topic.

Not sure if it works with phpBB 3.0.0

Thanks

BondGamer
Registered User
Posts: 435
Joined: Mon Dec 15, 2003 7:49 pm
Contact:

Re: [Beta] Stop Author View Increase 0.0.2

Post by BondGamer » Fri Jun 06, 2008 5:40 pm

cuteprincess2k wrote:I did as per instruction in the txt file . But the topic view counter increases when the topic poster "views" the topic.
I just tested it out on my forum and it worked fine. Did you save the modifications before uploading? Did you upload viewtopic.php in the right place?
My phpBB3 Mods: - None active =[

LaylaChaos
Registered User
Posts: 25
Joined: Wed May 23, 2007 7:46 am

Re: [Beta] Stop Author View Increase 0.0.2

Post by LaylaChaos » Tue Jun 17, 2008 2:07 am

As for the extra feature... I think that would be useless I just hate to increase the view count when I look at my own topics to read new replies I only want to know how many times other people looked at it. Otherwise I just get confused and expect too much replies... But of course that's only my opinion! I love this mod but because it's still beta I'm not using it yet... are there any bugs that need to be fixed? I'm waiting very inpatiently for this to be ready because I don't dare to use my board before... But please take your time to get it fixed that's really the most important!

GameraFan
Registered User
Posts: 20
Joined: Mon Jan 30, 2006 9:41 pm

Re: [Beta] Stop Author View Increase 0.0.2

Post by GameraFan » Tue Sep 09, 2008 8:47 pm

Thanks for this. Works as expected on 3.0.2.

Bv202
Registered User
Posts: 109
Joined: Tue Jun 24, 2008 12:32 pm

Re: [Beta] Stop Author View Increase 0.0.2

Post by Bv202 » Fri Sep 12, 2008 3:25 pm

Doesn't work here. The views still increases.

User avatar
Gremlinn
Registered User
Posts: 2133
Joined: Mon Aug 04, 2003 12:13 am
Location: Rochester, NY
Name: Nathan

Re: [Beta] Stop Author View Increase 0.0.2

Post by Gremlinn » Fri Sep 12, 2008 3:39 pm

Post your edits. ( couple lines above and below ).

Wolf2581
Registered User
Posts: 2
Joined: Wed Oct 01, 2008 11:04 am
Location: Joliet, Illinois, USA

Re: [Beta] Stop Author View Increase 0.0.2

Post by Wolf2581 » Tue Oct 21, 2008 4:35 pm

In viewtopic.php, I replaced

Code: Select all

	$sql = 'UPDATE ' . TOPICS_TABLE . '
		SET topic_views = topic_views + 1, topic_last_view_time = ' . time() . "
		WHERE topic_id = $topic_id";
	$db->sql_query($sql);
with

Code: Select all

	if ($user->data['user_id'] != $topic_data['topic_poster'] && !$user->data['is_bot'])
	{
		$sql = 'UPDATE ' . TOPICS_TABLE . '
			SET topic_views = topic_views + 1, topic_last_view_time = ' . time() . "
			WHERE topic_id = $topic_id";
		$db->sql_query($sql);
	}
and authors' views still increase view counts.

User avatar
Gremlinn
Registered User
Posts: 2133
Joined: Mon Aug 04, 2003 12:13 am
Location: Rochester, NY
Name: Nathan

Re: [Beta] Stop Author View Increase 0.0.2

Post by Gremlinn » Tue Oct 21, 2008 5:01 pm

Be sure that you uploaded/saved the updated file. That IS the only change needed.

There is one small change I think I might make on my sites. That would be to move the closing } to enclose the next if statement (the update for attachments).

Wolf2581
Registered User
Posts: 2
Joined: Wed Oct 01, 2008 11:04 am
Location: Joliet, Illinois, USA

Re: [Beta] Stop Author View Increase 0.0.2

Post by Wolf2581 » Fri Oct 24, 2008 8:31 am

Gremlinn, I looked at my code for what you said about the attachment update and noticed it was missing. Maybe my viewtopic.php did not properly update during a previous upgrade. I uploaded a stock 3.0.2 viewtopic.php, changed the code, and now this mod works.

User avatar
Gremlinn
Registered User
Posts: 2133
Joined: Mon Aug 04, 2003 12:13 am
Location: Rochester, NY
Name: Nathan

Re: [Beta] Stop Author View Increase 0.0.2

Post by Gremlinn » Fri Oct 24, 2008 11:43 am

Cool. Glad you got it working.

frank jance
Registered User
Posts: 25
Joined: Fri Nov 25, 2005 6:35 pm

Re: [Beta] Stop Author View Increase 0.0.2

Post by frank jance » Sun Nov 23, 2008 9:38 pm

I installed this on phpBB 3.0.3 and, unfortunately, it doesn't work for me. Here's my code:

Code: Select all

{
//	$sql = 'UPDATE ' . TOPICS_TABLE . '
//		SET topic_type = ' . POST_NORMAL . ', topic_time_limit = 0
//		WHERE topic_id = ' . $topic_id;
//	$db->sql_query($sql);

#------[ Replace Above Lines With ]------
// Stop Author View Increase code
if ($user->data['user_id'] != $topic_data['topic_poster'] && !$user->data['is_bot'])
	{
		$sql = 'UPDATE ' . TOPICS_TABLE . '
			SET topic_views = topic_views + 1, topic_last_view_time = ' . time() . "
			WHERE topic_id = $topic_id";
		$db->sql_query($sql);
	}
#----------------------------------------

	$topic_data['topic_type'] = POST_NORMAL;
	$topic_data['topic_time_limit'] = 0;
}
I've double and triple checked the code and everything looks fine to me. Any ideas?

Thanks,
Frank

User avatar
Gremlinn
Registered User
Posts: 2133
Joined: Mon Aug 04, 2003 12:13 am
Location: Rochester, NY
Name: Nathan

Re: [Beta] Stop Author View Increase 0.0.2

Post by Gremlinn » Mon Nov 24, 2008 3:04 pm

Try this for that section:

Code: Select all

// Update topic view and if necessary attachment view counters ... but only for humans and if this is the first 'page view'
if (isset($user->data['session_page']) && !$user->data['is_bot'] && strpos($user->data['session_page'], '&t=' . $topic_id) === false)
{
	if ($user->data['user_id'] != $topic_data['topic_poster'] && !$user->data['is_bot'])
	{
		$sql = 'UPDATE ' . TOPICS_TABLE . '
			SET topic_views = topic_views + 1, topic_last_view_time = ' . time() . "
			WHERE topic_id = $topic_id";
		$db->sql_query($sql);

		// Update the attachment download counts
		if (sizeof($update_count))
		{
			$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
				SET download_count = download_count + 1
				WHERE ' . $db->sql_in_set('attach_id', array_unique($update_count));
			$db->sql_query($sql);
		}
	}
}
Notice, I wrapped the attachment section too.

frank jance
Registered User
Posts: 25
Joined: Fri Nov 25, 2005 6:35 pm

Re: [Beta] Stop Author View Increase 0.0.2

Post by frank jance » Mon Nov 24, 2008 4:35 pm

Gremlinn wrote:Try this for that section:
Thanks for the reply. I hate to tell you this, but the count still increases with this code change. :(
Notice, I wrapped the attachment section too.
I don't know if this has anything to do with it, but the attachment code that you reference is not in that section. On my copy of viewtopic.php, that code is on line 1535. This is on a recent, clean install of phpBB 3.0.3.

Frank

Locked

Return to “[3.0.x] MODs in Development”