Previous Thread
Next Thread
Print Thread
Rate Thread
#317550 09/10/2008 6:44 PM
Joined: Jul 2003
Posts: 46
User
User
Offline
Joined: Jul 2003
Posts: 46
Hi guys,

Rick suggested I put a request here so I can get a problem fixed.

Just to make it easy here is the topic...

http://www.ubbcentral.com/forums/ubbthreads.php/topics/216481/Topic_Views.html#Post216481

In a nutshell I want topic views to increase every time someone clicks on a topic, whether it be the same person looking at the information twice or two different people.

I hope this makes sense, if not please let me know.

Thanks in advance.

Sponsored Links
FREAK1 #317552 09/11/2008 2:28 AM
Joined: Feb 2007
Posts: 329
Yarp™
Yarp™
Offline
Joined: Feb 2007
Posts: 329
Do you also want it to count if they go to a 2nd page from a topic?

That's a bit a of the problem if you really want to count every click, and not every new visit to the topic.

Joined: Jul 2003
Posts: 46
User
User
Offline
Joined: Jul 2003
Posts: 46
I don't think a click to a 2nd page is necessary. I have members that will come to the board, leave and come back. I don't care if they do it 20 times, but I want it to count as 20 topic hits. Instead of 1 because they didn't clear a cookie.

I hope that makes sense and thanks for the reply.

FREAK1 #317554 09/12/2008 2:49 AM
Joined: Feb 2007
Posts: 329
Yarp™
Yarp™
Offline
Joined: Feb 2007
Posts: 329
It actually makes it more difficult. You would need some mechanism that tracks if you just clicked to a new page in the topic, or visit the topic fresh.

I am thinking about the referrer variable to check for that.

You are running 7.1.1 and using spider friendly url's right?

Last edited by blaaskaak; 09/12/2008 2:50 AM.
Joined: Jul 2003
Posts: 46
User
User
Offline
Joined: Jul 2003
Posts: 46
If it makes it easier to count as a view by clicking to a 2nd or 3rd page that's fine.

I am using 7.1.1. and spider friendly. They like to visit the site.

Sponsored Links
FREAK1 #317564 09/13/2008 11:40 PM
Joined: Feb 2007
Posts: 329
Yarp™
Yarp™
Offline
Joined: Feb 2007
Posts: 329
ok. I'll do this coming wednesday, I have a day off then.

Joined: Jul 2003
Posts: 46
User
User
Offline
Joined: Jul 2003
Posts: 46
Blaaskaak thank you for doing this. smile It is greatly appreciated.

FREAK1 #317573 09/18/2008 1:15 AM
Joined: Feb 2007
Posts: 329
Yarp™
Yarp™
Offline
Joined: Feb 2007
Posts: 329
You need to modify 2 files:


find:

/scripts/showthreaded.inc.php

PHP Code
 if ($_SESSION['current_topic'] != $main_topic_id) {
$query = "
insert into
{$config['TABLE_PREFIX']}TOPIC_VIEWS
(TOPIC_ID)
values
( ? )
"
;
$dbh -> do_placeholder_query($query,array($main_topic_id),__LINE__,__FILE__);
$_SESSION['current_topic'] = $main_topic_id;
}


Replace with:

PHP Code
//	if ($_SESSION['current_topic'] != $main_topic_id) {
$query = "
insert into
{$config['TABLE_PREFIX']}TOPIC_VIEWS
(TOPIC_ID)
values
( ? )
"
;
$dbh -> do_placeholder_query($query,array($main_topic_id),__LINE__,__FILE__);
$_SESSION['current_topic'] = $main_topic_id;
// }




/scripts/showflat.inc.php

PHP Code
 if ($_SESSION['current_topic'] != $current) {
$query = "
insert into
{$config['TABLE_PREFIX']}TOPIC_VIEWS
(TOPIC_ID)
values
( ? )
"
;
$dbh -> do_placeholder_query($query,array($current),__LINE__,__FILE__);
$_SESSION['current_topic'] = $current;
}


Replace with:

PHP Code
//	if ($_SESSION['current_topic'] != $current) {
$query = "
insert into
{$config['TABLE_PREFIX']}TOPIC_VIEWS
(TOPIC_ID)
values
( ? )
"
;
$dbh -> do_placeholder_query($query,array($current),__LINE__,__FILE__);
$_SESSION['current_topic'] = $current;
// }


Joined: Feb 2007
Posts: 329
Yarp™
Yarp™
Offline
Joined: Feb 2007
Posts: 329
Hm, I would skip that hack for viewthreaded.php... Every message you read is a click. I don't know if you disabled threaded view, but if you didn't, I would stick with the default behavior of the script.

Please mind that it will still cache the view counter, it won't be updated until a post is made.

edit: I just saw the thread on ubbcentral, and it's the same as Rick suggested there. Don't know why it would stop with counting all together, I've tested it, and it works.

Last edited by blaaskaak; 09/18/2008 1:56 AM.
Joined: Jul 2003
Posts: 46
User
User
Offline
Joined: Jul 2003
Posts: 46
blaaskaak thanks, I haven't done anything yet. I have to find where these items are located to make the changes.

Just so I am perfectly clear, am I still doing both of them or just one. If one, is it the top or the bottom one.

Please advise as I am going to attempt to do this tomorrow evening if I can find what you are telling me to change.

Thanks again for all of your help.

Sponsored Links
FREAK1 #317577 09/19/2008 1:46 AM
Joined: Feb 2007
Posts: 329
Yarp™
Yarp™
Offline
Joined: Feb 2007
Posts: 329
/yourforum/scripts/showthreads.inc.php

that's the one you want to change. But it is the same change Rick asked you to do.

Joined: Jul 2003
Posts: 46
User
User
Offline
Joined: Jul 2003
Posts: 46
Ok now I am lost !!! So now do none of them?

FREAK1 #317579 09/20/2008 5:18 AM
Joined: Feb 2007
Posts: 329
Yarp™
Yarp™
Offline
Joined: Feb 2007
Posts: 329
well, do the one for showflat.inc.php

Joined: Jul 2003
Posts: 46
User
User
Offline
Joined: Jul 2003
Posts: 46
I did the top one.. Seems to have worked because the views are up. smile


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Posts: 70
Joined: January 2007
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)