Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2009-07-24 13:05:38

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,456
Website

Re: smd_lately: recently viewed site articles

Small update. Just realised I’d inadvertently made it a TXP 4.2.0-only plugin by using the remote_addr() function. v0.11 is now backwards compatible with TXP 4.0.8. Sorry for the hiccup.

Last edited by Bloke (2009-07-24 13:08:06)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#12 2009-08-10 03:24:56

mwr
Member
From: Canada
Registered: 2006-01-31
Posts: 151
Website

Re: smd_lately: recently viewed site articles

Sorry, but I can’t get it to work with sections. For example

<txp:smd_lately by=”“ sort=“popularity” />

works as advertised, but

<txp:smd_lately by=”“ section=“games” sort=“popularity” />

shows nothing.

I’m using TXP 4.0.8.


Mark

Offline

#13 2009-08-10 08:33:52

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,456
Website

Re: smd_lately: recently viewed site articles

mwr wrote:

Sorry, but I can’t get it to work with sections.

Hmmm, one thing I forgot to mention that I think might affect the filtering ability (though I didn’t actually test, admittedly) is that if you are not using a permlink mode with /section in it then the plugin probably can’t filter by section :-(

As it uses the log files to determine who’s watching what, and the log entries are written to the log in the current permlink mode, we are unfortunately bound by the permlink mode currently in force. If you’re using section/title, section/id/title or messy mode and it’s still not working, please add debug="2" to the plugin tag and let me know what you get out.

In the meantime, here’s a minor update to stop a horrible warning if a non-article entry slips through the net:

Download v0.12

EDIT: one thing I might be able to do in the plugin is offer an option that would force all log hits to be in the /section/title format. The upside is that you’ll be able to filter by section; the downside is that the clickable links in your Visitor Logs tab will no longer work unless you use gbp_permanent_links to reroute them to your current permlink scheme. Let me know what you (anyone!) thinks about this feature.

Last edited by Bloke (2009-08-10 09:01:55)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#14 2009-08-10 15:46:15

mwr
Member
From: Canada
Registered: 2006-01-31
Posts: 151
Website

Re: smd_lately: recently viewed site articles

I was using /title and switched to section/title, but still no luck. Here’s what I get with debug.

SELECT count(page) as popularity, page, MAX(time) as time FROM txp_log WHERE 1=1 AND page NOT REGEXP '^/$' AND page NOT REGEXP 'q=' AND page NOT REGEXP 'c=' AND page NOT REGEXP 'category=' AND page NOT REGEXP '^/category/' AND page NOT REGEXP 'author=' AND page NOT REGEXP '^/author/' AND (page REGEXP '^/Games' AND page NOT REGEXP '^/Games/?$') AND status = 200 GROUP BY page ORDER BY popularity desc
array (
  0 => 
  array (
    'popularity' => '3',
    'page' => '/Games/warsow',
    'time' => '2009-08-10 15:41:25',
  ),
  1 => 
  array (
    'popularity' => '2',
    'page' => '/games/index.php',
    'time' => '2009-08-10 06:28:01',
  ),
)

edited for code display

Last edited by Bloke (2009-08-10 15:54:15)


Mark

Offline

#15 2009-08-10 16:08:21

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,456
Website

Re: smd_lately: recently viewed site articles

Curious. The debug shows it’s clearly finding something in the logs that match. It shouldn’t be picking up index.php in the games section; I’ll have to alter the plugin so index.php is omitted. I assume warsow is actually an article and is viewable (i.e. is not in the future or anything)? You should at least see that one because the plugin found it. Very odd if it shows nothing.

Does it still show nothing if you visit quite a few more articles first? What about if you use the plugin as a container? Do you have any other plugins such as gbp_permanent_links installed? I’m not sure if any of that’ll make any difference: stabbing in the dark here, sorry.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#16 2009-08-10 16:43:13

mwr
Member
From: Canada
Registered: 2006-01-31
Posts: 151
Website

Re: smd_lately: recently viewed site articles

It’s working now — not sure why. Maybe it needed time to pick up some hits using the /section/title system.

In any case, thanks for the great plug-in. It’s long been needed.


Mark

Offline

#17 2009-08-22 00:55:20

paperboy
Member
From: Gothenburg, SE
Registered: 2006-01-24
Posts: 30
Website

Re: smd_lately: recently viewed site articles

I’m using this to show popular articles, so far so good, but someone is constantly sending hits to one of my pages (looks like they’re trying to spam it through the comment form) and after a day or two this page shows up as the most popular. I’ve blocked 10 IP-addresses so far.

Is there an easy way to exclude empty referrers or have each IP only counted once? Otherwise I think I’ll just add the page to the filter array and never have it show up again on the list! :P

Offline

#18 2009-08-22 01:09:11

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,456
Website

Re: smd_lately: recently viewed site articles

paperboy

Can you employ any of gocom’s plugins to try and combat this? For example rah_comment_spam, rah_ip_range or rah_unlog_me?

Not sure if smd_lately can do anything about logspam because it’s just counting what it sees and has no other built in intelligence. I could look into offering an empty referrer and/or IP count limiter though. Will see if it’s possible.

Last edited by Bloke (2009-08-22 01:09:56)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#19 2009-08-25 23:53:24

paperboy
Member
From: Gothenburg, SE
Registered: 2006-01-24
Posts: 30
Website

Re: smd_lately: recently viewed site articles

Empty referrer or IP count limiter would be nice if you plan on expanding the plug-in but I’ll manage with rah_unlog_me for now. :)

Offline

#20 2009-09-11 13:10:26

simoin
Member
From: Ireland
Registered: 2009-02-10
Posts: 50
Website

Re: smd_lately: recently viewed site articles

Is there a way of showing a count of how many times the article has been viewed?
it would be nice to display this if you were using sort=“popularity” with the plugin

Offline

Board footer

Powered by FluxBB