• Resolved hooty940

    (@hooty940)


    After adding the following to my functions.php file, the “Use persistent mode” checkbox was still visible to site administrators:

    add_filter(‘disable_comments_allow_persistent_mode’, ‘__return_false’);

    On line #354 of disable-comments.php, it appears the filter is not applied when a WordPress install is not in Multisite mode:

    return ( !is_multisite() || ( !$this->networkactive && apply_filters( 'disable_comments_allow_persistent_mode', true ) ) );

    I was able to hide the “Use persistent mode” checkbox afterI made the following edit to line #354:

    return ( !is_multisite() && apply_filters( 'disable_comments_allow_persistent_mode', true ) || ( !$this->networkactive && apply_filters( 'disable_comments_allow_persistent_mode', true ) ) );

    Is this a possible bug? I am running WP 3.5.1, non-multisite, on the Genesis Framework.

    Thanks!

    http://ww.wp.xz.cn/extend/plugins/disable-comments/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Samir Shah

    (@solarissmoke)

    Hi,

    The original purpose of the hook was to allow multisite superadmins to hide the option from site admins (hence it only works in multisite mode). I wanted to avoid admins being able to hide the option from themselves!

    However, thinking about it, it makes sense just to open it up to everyone who is able to edit functions.php and assume that they know what they are doing. I will fix it in the next release.

    Plugin Contributor Samir Shah

    (@solarissmoke)

    PS, you should change your hack to the following:

    return apply_filters( 'disable_comments_allow_persistent_mode', true );

    Thread Starter hooty940

    (@hooty940)

    Hi there,

    Thank you!

    I totally understand it now, and I appreciate you changing this in the next release.

    Plugin Contributor Samir Shah

    (@solarissmoke)

    Fixed in version 0.9.1

    return apply_filters( ‘disable_comments_allow_persistent_mode’, true );

    where i put this???

    Thread Starter hooty940

    (@hooty940)

    In the functions.php file.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Trouble with using hook to hide Persistent Mode options’ is closed to new replies.