Thanks for reporting, @hleenwp. Will fix this up and push out a new update asap.
@hleenwp Looking into this, I downloaded the count addon and enabled with BBQ, everything works fine. The filter hook bbq_count_plugin_path is for changing the default location of the count addon. So the hook is needed only if you want to change the location. And in that case, the correct hook to use is bbq_count_plugin_path. I’m not sure where you’re getting bbq_block_count_plugin_path but it is not something that is used in the plugin. Unless I am missing something here, let me know. Thank you.
Hi Jeff.
I am not a WP expert, so apologies if I have it wrong…
I retested this issue.
– Installed BBQ (is installed in directory “block-bad-queries”)
– Install BBQ Block Count (is installed in directory “bbq-block-count”)
Checked the settings of BBQ: no count is displayed
I found that the change I mentioned earlier was not correct.
I actually changed the code in bbq-settings.php, bbq_maybe_display_count() to
if ( is_plugin_active( 'bbq-block-count/bbq-block-count.php' ) ) {
and now the counter is displayed.
I tested the response of
apply_filters('bbq_count_plugin_path', 'bbq-block-count.php')
And it returns “bbq-block-count.php” which is not the directory where the plugin is installed.
Digging into the documentation and it appears to be that if a filter is not not added to the code it simply returns the argument, in this case bbq-block-count.php
I guess there should be a “add_filter(…)” somewhere in the code but (default) it is not there.
So “is_plugin_active(‘bbq-block-count.php’)” will not return the correct value and assumes the plugin is not installed.
I ended up with this, which handles both situations (with and without filter):
if (is_plugin_active('bbq-block-count/bbq-block-count.php')
or is_plugin_active(apply_filters('bbq_count_plugin_path', 'bbq-block-count.php')) )
{...}
Hope I am correct?
Regards, hleenWP
Ok will take another look for the next plugin update. Thank you for the detailed information, hleenWP.
Looking closer at this, I *think* what’s happening is that you have installed the block-count plugin in its own directory. So in that case, here are the steps to set it up when BBQ Firewall is active:
- Download and install the block-count plugin
- Add the following code snippet:
function bbq_count_plugin_path($path) {
return 'bbq-block-count/bbq-block-count.php';
}
add_filter('bbq_count_plugin_path', 'bbq_count_plugin_path');
The snippet can be added via theme functions.php or simple plugin. Here is a guide that explains either method.
Those two steps should do the trick. Let me know how it goes, or if I can provide any further information.