Support » Plugin: Glance That » Filters not working

  • Resolved jdnn

    (@habannah)


    I have the following in my wp-config file:

    /**
     * To restrict modifications to Glance That for everyone but the admin.
     */
    define( 'GT_EDIT_GLANCES', 'manage_options' );
    
    /**
     * To show all statuses in Glance That.
     */
    define( 'GT_SHOW_ZERO_COUNT_STATUS', true );
    define( 'GT_SHOW_ZERO_COUNT', true );
    define( 'GT_SHOW_ALL-STATUS', true );
    define( 'GT_SHOW_MUSTUSE', true );
    define( 'GT_SHOW_DROPINS', true );
    define( 'GT_SHOW_ADD_NEW', true );
    define( 'GT_SHOW_ARCHIVE', true );
    
    /**
     * To show Glance That settings.
     */
    define( 'gt_show_settings', true );
    
    /**
     * To hide social links in Glance That.
     */
    define( 'gt_show_applause', false);
    • Must-use plugins aren’t showing
    • Drop-in plugins aren’t showing
    • Applause links aren’t hidden
    • Is GT_EDIT_GLANCES still the right filter? It’s not listed with the other filters on the plugin page, but it still seems different than gt_view_at_a_glance…

    Using all-caps or not shouldn’t matter, right?

    Really wish there was a regular settings page instead of having to edit the wp-config file to make changes!

    Thanks in advance for any help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author uamv

    (@uamv)

    @habannah Sorry for the troubles here! Yes, you’re correct in editing your review by stating “HAVE to because the plugin author made yet another change to the settings.” I had some time ago begun to introduce filters that would eventually replace the constants in the plugin. I (unwisely) finally removed those in the most recent version. I could add them back in if it is considered the better approach. Some time ago, I began to lean toward filters instead of constants. So, for now the following filters can be added to define your settings.

    
    /**
     * To restrict modifications to Glance That for everyone but the admin.
     */
    add_filter( 'gt_edit_glances', function() { return 'manage_options' } );
    
    /**
     * To show all statuses in Glance That.
     */
    add_filter( 'gt_show_zero_count', '__return_true' );
    add_filter( 'gt_show_zero_count_status', '__return_true' );
    add_filter( 'gt_show_all_status', '__return_true' );
    add_filter( 'gt_show_mustuse', '__return_true' );
    add_filter( 'gt_show_dropins', '__return_true' );
    add_filter( 'gt_show_add_new', '__return_true' );
    add_filter( 'gt_show_archive', '__return_true' );
    
    /**
     * To show Glance That settings.
     */
    add_filter( 'gt_show_settings', '__return_true' );
    
    /**
     * To hide social links in Glance That.
     */
    add_filter( 'gt_show_applause', '__return_false' );
    

    You are also correct that the plugin is probably about due for a setting page as these options have grown in number.

    I appreciate that you’ve been a long time user and have found the plugin helpful. Thanks for the feedback and sorry for the trouble!

    Thread Starter jdnn

    (@habannah)

    @uamv Really glad to hear that there are filters now instead of constants. That is so much better! But yes, since there are so many of them, it may be time for a settings page. And besides, I also find the buttons at the top of the widget confusing at times. Having more space to explain things on a settings page might be useful.

    Thank you very much for the updated code. I will be using the filters from now on, until a settings page gets added 😉 But perhaps the constants should be re-added, as you suggest, for backwards compatibility? A note in the change log that constants had been removed and replaced by filters would have helped… Did I miss that somehow?

    I appreciate the effort you are making at consistency, and would be happy to revise my review again. No need to apologize for anything. You’re doing a great job!

    NB: Just a note for anyone who might be copying the code that there is a little typo in the first line. Just needed to add a semi-colon:

    /**
     * To restrict modifications to Glance That for everyone but the admin.
     */
    add_filter( 'gt_edit_glances', function() { return 'manage_options'; } );
    Plugin Author uamv

    (@uamv)

    Yes, others have mentioned that the buttons could use more clarification. Thanks for catching my typo! Oops.

    I thought I had mentioned the switchover in the changelog, but I’m not able to locate it. I must have only put it in the Upgrade Notice – or overlooked it completely.

    Thread Starter jdnn

    (@habannah)

    No problem, and no worries! 😀

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Filters not working’ is closed to new replies.