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#Post216481In 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.
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.
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.
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?
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.
ok. I'll do this coming wednesday, I have a day off then.
Blaaskaak thank you for doing this.
It is greatly appreciated.
You need to modify 2 files:
find:
/scripts/showthreaded.inc.php
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:
$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
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:
$query = "
insert into {$config['TABLE_PREFIX']}TOPIC_VIEWS
(TOPIC_ID)
values
( ? )
";
$dbh -> do_placeholder_query($query,array($current),__LINE__,__FILE__);
$_SESSION['current_topic'] = $current;
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.
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.
/yourforum/scripts/showthreads.inc.php
that's the one you want to change. But it is the same change Rick asked you to do.
Ok now I am lost !!! So now do none of them?
well, do the one for showflat.inc.php
I did the top one.. Seems to have worked because the views are up.