• Resolved matthew.a.hawker

    (@matthewahawker)


    Hello Hector.

    Thanks for the useful plugin; it’s really a great tool.

    I’d like to report a bug in the plugin that causes display data to get mixed between multisite blogs up when using the short tag or when calling wpp_get_mostpopular directly. The problem is on lines 1799-1802:

    $transient_name = md5(json_encode($instance));
    $mostpopular = ( function_exists( ‘is_multisite’ ) && is_multisite() )
    ? get_site_transient( $transient_name )
    : get_transient( $transient_name );

    However, if calling wpp_get_mostpopular() or using the shorttag with the same parameters on different blogs in a multisite installation, $instance be the same and so the method will result in the posts from one blog being cached and shown on all the blogs.

    As far as I can tell, there’s no reason to use site transients here; it should just be get_transient/set_transient. So, lines 1800-1802 should simply be:

    $mostpopular = get_transient($transient_name);

    and lines 1838-1840 should simply be:

    set_transient($transient_name, $mostpopular, $expiration);

    Thanks again for your work and I hope this helps :).

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Transient bug in multisite’ is closed to new replies.