Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: live627 on July 16, 2015, 09:15:43 AM

Title: Topic View Log
Post by: live627 on July 16, 2015, 09:15:43 AM
Link to the mod (https://custom.simplemachines.org/index.php?mod=4060)

This is a fork of the original mod by [SiNaN] (http://www.simplemachines.org/community/index.php?action=profile;u=118168) - http://www.simplemachines.org/community/index.php?topic=251656.msg1629997#msg1629997

Changes:
- 1.1.x support removed
- Hits are no longer grouped by member

https://github.com/live627/smf-topic-view-log
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.creativecommons.org%2Fl%2Fby-nc-sa%2F3.0%2F88x31.png&hash=be27368905a4a8052533722bf679594f2501899d) (http://creativecommons.org/licenses/by-nc-sa/3.0/)
Title: Re: Topic View Log
Post by: Shambles on July 16, 2015, 11:58:40 AM
QuoteHits are no longer grouped by member

Isn't that a reduction in functionality? In the absence of screenshots, does this mean each topic 'hit' generates a separate output line in the topic view?
Title: Re: Topic View Log
Post by: live627 on July 16, 2015, 07:31:34 PM
QuoteIn the absence of screenshots, does this mean each topic 'hit' generates a separate output line in the topic view?
Yes
Title: Re: Topic View Log
Post by: Shambles on July 17, 2015, 03:36:39 AM
Okidoki.

In my mind, that's a backwards step.
Title: Re: Topic View Log
Post by: madturnip on July 19, 2015, 06:55:49 PM
Everytime I go to topic view all I see is ME who has viewed it.  Is there something I am doing wrong as the installation never said there were any errors?
Title: Re: Topic View Log
Post by: Gryzor on August 10, 2015, 02:42:26 AM
Is this supposed to have its own settings page in the Admin area? I can't find anything... thanks!
Title: Re: Topic View Log
Post by: Shambles on August 10, 2015, 04:42:01 AM
If it's a faithful fork, it'll have permissions settings:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FL1Tm4.png&hash=88a99bd73290028f0114775a0479eb8cf906f053)
Title: Re: Topic View Log
Post by: Gryzor on August 10, 2015, 04:47:32 AM
Oh, it's in permissions. Right, I was looking around in he Admin area settings for a mod section... Thanks!
Title: Re: Topic View Log
Post by: mikedijital on September 30, 2015, 09:25:04 PM
Everything installed great but i noticed no text in the permissions area. can anyone help?
Title: Re: Topic View Log
Post by: mikedijital on September 30, 2015, 09:29:39 PM
I figured it out this

$txt['permissionname_tvl_view'] = 'View topic view log';
$txt['permissionhelp_tvl_view'] = 'This permission allows users to view the topic view log.';
$txt['permissionname_tvl_view_own'] = 'Own topic';
$txt['permissionname_tvl_view_any'] = 'Any topic';
$txt['permissionname_simple_tvl_view_own'] = 'View own topic view log';
$txt['permissionname_simple_tvl_view_any'] = 'View any topic view log';


needs to be added anywhere in themes/default/languages/managepermissions.english.php

im not quite sure why its not done as part of the install .. i had no errors during install.   

SMF 2.0.11
Title: Re: Topic View Log
Post by: runningtrades on October 11, 2016, 02:33:05 PM
Quote from: madturnip on July 19, 2015, 06:55:49 PM
Everytime I go to topic view all I see is ME who has viewed it.  Is there something I am doing wrong as the installation never said there were any errors?

i am having the same issue after installing the mod. I can not find the permissions for the mod either....
Title: Re: Topic View Log
Post by: Shambles on October 11, 2016, 02:36:29 PM
http://www.simplemachines.org/community/index.php?topic=538187.msg3829305#msg3829305
Title: Re: Topic View Log
Post by: runningtrades on October 11, 2016, 02:44:45 PM
Quote from: Shambles on October 11, 2016, 02:36:29 PM
http://www.simplemachines.org/community/index.php?topic=538187.msg3829305#msg3829305

found it...had to add the code to both english language files....

still only showing me in the log files though...not showing other member's who have viewed the topic
Title: Re: Topic View Log
Post by: runningtrades on October 12, 2016, 03:40:20 PM
it seems it will only log the last user...not multiple users who viewed the log
Title: Re: Topic View Log
Post by: runningtrades on October 13, 2016, 01:54:00 PM
Quote from: runningtrades on October 12, 2016, 03:40:20 PM
it seems it will only log the last user...not multiple users who viewed the log

any solutions? I can now see multiple pages, but only one user name on the first page, after that, all of the other pages are blank...
Title: Re: Topic View Log
Post by: aegersz on October 18, 2016, 09:45:32 PM
Quote from: mikedijital on September 30, 2015, 09:29:39 PM
I figured it out this

$txt['permissionname_tvl_view'] = 'View topic view log';
$txt['permissionhelp_tvl_view'] = 'This permission allows users to view the topic view log.';
$txt['permissionname_tvl_view_own'] = 'Own topic';
$txt['permissionname_tvl_view_any'] = 'Any topic';
$txt['permissionname_simple_tvl_view_own'] = 'View own topic view log';
$txt['permissionname_simple_tvl_view_any'] = 'View any topic view log';


needs to be added anywhere in themes/default/languages/managepermissions.english.php

im not quite sure why its not done as part of the install .. i had no errors during install.   

SMF 2.0.11

thanks, that worked.
Title: Re: Topic View Log
Post by: aegersz on October 19, 2016, 03:04:30 AM
Quote from: runningtrades on October 12, 2016, 03:40:20 PM
it seems it will only log the last user...not multiple users who viewed the log

same here (at 2.0.11), only shows one viewer. The database entries are OK as i see multiple enties for the individual topics.
Title: Re: Topic View Log
Post by: aegersz on October 19, 2016, 05:48:30 AM
... (continued from above) I have been trying to debug the code by dumping variables but they all look good.

something is stopping the list from populating but my php debugging skills are basic ... at least i tried.
Title: Re: Topic View Log
Post by: aegersz on October 19, 2016, 08:03:58 AM
check the following SQL statement as ONLY 1 row is returned (if it's correct then maybe it should be called for each row that contains the topic number):

                SELECT
                        mem.id_member, mem.member_name, mem.real_name, mg.group_name,
                        tvl.time, COUNT(m.id_msg) AS topic_posts
                FROM {db_prefix}log_topic_view AS tvl
                        LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = tvl.id_member)
                        LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = CASE WHEN mem.id_group = {int:regular_id_group} THEN mem.id_post_group ELS$
                        LEFT JOIN {db_prefix}messages AS m ON (m.id_member = mem.id_member AND m.id_topic = tvl.id_topic)
                WHERE tvl.id_topic = {int:topic}
                ORDER BY {raw:sort}
                LIMIT {int:start}, {int:per_page}',
                array(
                        'sort' => $sort,
                        'start' => $start,
                        'per_page' => $items_per_page,
                        'topic' => $topic,
                        'regular_id_group' => 0,
                )

Title: Re: Topic View Log
Post by: runningtrades on October 19, 2016, 08:46:09 AM
Quote from: aegersz on October 19, 2016, 08:03:58 AM
check the following SQL statement as ONLY 1 row is returned (if it's correct then maybe it should be called for each row that contains the topic number):

                SELECT
                        mem.id_member, mem.member_name, mem.real_name, mg.group_name,
                        tvl.time, COUNT(m.id_msg) AS topic_posts
                FROM {db_prefix}log_topic_view AS tvl
                        LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = tvl.id_member)
                        LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = CASE WHEN mem.id_group = {int:regular_id_group} THEN mem.id_post_group ELS$
                        LEFT JOIN {db_prefix}messages AS m ON (m.id_member = mem.id_member AND m.id_topic = tvl.id_topic)
                WHERE tvl.id_topic = {int:topic}
                ORDER BY {raw:sort}
                LIMIT {int:start}, {int:per_page}',
                array(
                        'sort' => $sort,
                        'start' => $start,
                        'per_page' => $items_per_page,
                        'topic' => $topic,
                        'regular_id_group' => 0,
                )




my debugging skills are non-existent...lol..did this work for you? The name of the member who viewed the log last changes, and I can see multiple pages, but only one member
Title: Re: Topic View Log
Post by: aegersz on October 19, 2016, 08:49:40 AM
the info I posted is intended to be for the guy who wrote it. I get the same thing as you but only on 1 page.

as I said, the database table it uses is correct but the query of it only returns the same one line - he expects a number of rows as he sets up an array to receive them.

buggered if i know, I'm just exploring the wonders of php+SQL and I'm only a novice.
Title: Re: Topic View Log
Post by: runningtrades on October 19, 2016, 05:56:08 PM
i get multiple pages, but can only see one name on the first page, but the name always changes, as members view the post
Title: Re: Topic View Log
Post by: aegersz on October 19, 2016, 06:05:01 PM
I was able to get two pages of blanks by altering a SQL query and I have run the SQL from the debugging mods on phpmyadmin and I get the exact same single line returned, despite there being multiple rows to be accessed.

I emailed the author because it's now beyond my current skillset ... i really like this mod BUT that database table is slowly growing with every thread view and that's another concern.

I can't see any code to process all the appropriate rows to provide a consice listing of viewers so I am even more confused !
Title: Re: Topic View Log
Post by: aegersz on October 24, 2016, 01:36:45 PM
i got it working but it produces HEAPS of information ... try my fix (and see if you like the amount of data it produces) by replacing the top 3 lines of the SQL SELECT code in function list_get_tvl_members in .Sources/TopicViewLog.php as shown below:

change the following:
                SELECT
                        mem.id_member, mem.member_name, mem.real_name, mg.group_name,
                        tvl.time, COUNT(m.id_msg) AS topic_posts


to the following:
                SELECT
                DISTINCT
                        mem.id_member, mem.member_name, mem.real_name, mg.group_name, tvl.time, mem.posts AS topic_posts
Title: Re: Topic View Log
Post by: runningtrades on November 02, 2016, 09:00:33 AM
that fix works perfectly! Thank you very much!!
Title: Re: Topic View Log
Post by: aegersz on November 02, 2016, 09:06:49 AM
You're welcome but I decided to Uninstall it due to the table it uses that is continually growing and the huge amount of pages it produces.

Good for every now and then though.
Title: Re: Topic View Log
Post by: runningtrades on November 02, 2016, 09:14:03 AM
I managed to track down an offending member that I was trying to weed out, so it served it's purpose for me! I'll probably keep the logs for now, see how big they get...if they get too big, I may remove it. But it helped me ban a member I was looking for!