WordPress.org

Ready to get started?Download WordPress

Forums

WP SlimStat Shortcodes
reset filters during page load? (4 posts)

  1. twmurphy
    Member
    Posted 1 year ago #

    Using Slimstat 2.8.2; shortcode 2.0. I find some counter-intuitive behavior that either means I'm doing something wrong, am not aware of additional functionality, or there's an actual problem.

    If I wanted to count all visits to a post called "tricksy" in the last year, I would be tempted to try the shortcode:

    [slimstat f='count' w='ip' lf='resource contains tricksy | month equals 1 | day equals 1 | interval equals -1']

    But this delivers zero counts. By random chance, I found that if I produce two shortcodes in a row:

    [slimstat f='count' w='ip' lf='resource contains tricksy']
    and
    [slimstat f='count' w='ip' lf='month equals 1 | day equals 1 | interval equals -1']

    I first get the number of accesses to the post in the current month, and THEN get the number I originally wanted. Ordinarily, the second line would produce the number of visits to the entire site in a year, but the first 'resource contains' filter is *sticky*. It applies to the second query as well.

    The problem is if stats for more than one post wants to be counted on the same page, the stickiness kills me. If I wanted to count access to the 'tricksy' post as above, then follow up with a count of accesses to a post called "false" then I would be tempted to go through the same two-step as before (why two steps?) and follow up with a second pair beginning:

    [slimstat f='count' w='ip' lf='resource contains false']

    but I get zero count because "tricksy" was sticky, and it now wants a resource that contains both tricksy and false, and there is no such post.

    So after all this gruesome detail, my question is if there is a way to clear or reset the filters for a second-pass at new statistics? Or am I doing something fundamentally wrong in my approach?

    http://wordpress.org/extend/plugins/wp-slimstat-shortcodes/

  2. camu
    Member
    Plugin Author

    Posted 1 year ago #

    I'll have to look at the source code, filters are not supposed to be 'sticky', each shortcode should start from a clean slate. One thing I noticed are the blank spaces around the separator. That could be one issue, and will be addressed in version 2.0.1, but in the meanwhile could you try to use

    [slimstat f='count' w='ip' lf='resource contains tricksy|month equals 1|day equals 1|interval equals -1']

    Let me know,
    Camu

  3. twmurphy
    Member
    Posted 1 year ago #

    I tried to remove the spaces, as suggested above, with no apparent change in effect. The desirable all-in-one construction above still delivers zero count, so the two-step appears to be necessary to count visits to a resource over arbitrary time. And in this case, the stickiness is part of the solution—although otherwise a nuisance.

    I still have a creeping feeling that I'm going about it all wrong.

  4. camu
    Member
    Plugin Author

    Posted 1 year ago #

    I'll look into this ASAP. Thanks for testing the workaround.

    Camu

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic