Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

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

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

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: 164
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: 11,250
Website GitHub

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: 164
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: 11,250
Website GitHub

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

#21 2009-09-11 13:52:36

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

Re: smd_lately: recently viewed site articles

simoin

Will v.013 do which introduces some useful replacement vars?


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

#22 2009-09-13 00:39:01

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

Re: smd_lately: recently viewed site articles

Thanks Bloke,
This is just what I was looking for!

Offline

#23 2009-09-13 08:21:58

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: smd_lately: recently viewed site articles

Maybe it’s worth to add attribute for setting length of search? For ex. look in logs for 1 day. or 1 week, or 48 hours, or 86400 seconds? For simplicity it can handle only seconds :)


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#24 2009-09-13 15:05:01

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

Re: smd_lately: recently viewed site articles

the_ghost wrote:

Maybe it’s worth to add attribute for setting length of search?

Great suggestion. Can’t believe I didn’t do it in the first place. For flexibility I’ll probably add a within attribute that allows you to limit the search to within the most recent N whatevers, and perhaps some way of specifying what “most recent” means. e.g. “show what’s new but only up to the end of the last whole month”. Thus it’d be within="1 month" to="01-?month-?year" — or something like that. Might add a from attribute as well, ‘cos that would allow for some cool paging features but I’d need to think it through.

For simplicity it can handle only seconds :)

If you want simplicity, you shouldn’t be using an smd_* plugin :oD


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

Board footer

Powered by FluxBB