I must be missing something in how I’m going about this, so set me straight if it’s wrong.
I have the iThemes extension in MainWP (now Solid Security) and it’s installed on many client websites but not all of them.
In my custom report it has a common method of outputting data.
The problem is that on the sites that don’t have Solid Security installed, these data points still output on the report, showing “0” as the value.
At first I thought the “$plugin_active_itsecurity” check was supposed to hide it if not installed, but then I realized that is only checking if the plugin is installed in MainWP itself, not the client site.
Then I figured the “$showhide_values” stuff was supposed to hide the output if nothing is returned, but this seems to not work at all because it’s still output anyway.
Next I tried to see if I could make my own PHP “if()” block using the token data, but of course I can’t put the tokens inside PHP functions in that way. Likewise, I can’t export the token data to the debug log or do other kinds of tests in PHP. I don’t know how these tokens are processed or if they are treated like normal WordPress shortcodes?
That said, my question is, how do I show the values for the iThemes data only if the client has the plugin installed and there are values to show? In my case, it is showing those data points even when the plugin isn’t installed on the client site at all!
If the plugin is installed on the client, then showing a 0 for the count would be fine if that were actually correct.
My idea was that, if I can pull that token data some other way beside using the shortcode style format, then I could check it with my own PHP tests before outputting.
I know there is an API for Pro Reports but I’m hoping there are PHP functions or classes I can access directly in my templates rather than try to code with cURL calls or something.
I looked in the latest default templates to see how they do it, and it’s basically the same. They do output a new token which is ‘[config-section-extra max-empty=“1” /]’. I have no idea what this is supposed to be doing. The documention and how the tokens work is really lacking. I’m having a hard time customizing or figuring out anything. I can’t work with the tokens since they can’t be used in PHP functions, I can’t output them, check them or debug log them and run my own logic. New tokens like that one above just pop out of nowhere and I didn’t know it existed or what it does and there is no documentation about it.
Go to the tokens documentation here or here and there is no mention of config-section-extra.
I tried using do_shortcode(“[a-token]”) but that just output the plain text token, not the replaced value. So even here I can’t treat them like a standard shortcode.
I just don’t know what to do. All I want is for iThemes data to not output if the client website doesn’t use the plugin. I also want to know if I can output or fetch the token data some other way than just the normal token syntax (to use with PHP) like an object or classe or global variables or something.
Thanks for any ideas!