Hello Support.
I have been working on conditional display of some content based upon if the user has access to a membership or not.
I use WishList member to manage the membership.
Wishlist member can handle inline content by a shortcode [wlm_private "<Memebershipname>"] THE CONTENT [/wlm_private]
So if the user is member of the membership, then "THE CONTENT" will be displayed.
Now in order for me to use this in a toolset condition I have considered to register it as a shortcode, but since the membership name is dynamic it makes no sense to register all sorts of short codes that I use on the site.
So I created a custom function that would take the shortcode string as a parameter, call do_shortcode and return the return value, which then could be evaluated with a static value in a toolset conditional block.
During debug I noticed that the actual string parameter handed to my custom function was the RENDERED outcome of the shortcode, not the shortcode as the string it was entered in the parameter field. And even if I did not even register the shortcode it would still render it, so basically the function did not work because the parameter was not a shortcode but the outcome of the shortcode.
So somewhere in the core of toolset, the parameter string will discover if the parameter string was a shortcode and render it, even if I have not registered it.
That made me think if I could simply make that function redundant by using the static value comparison and place the short code inside a static value. (which basically changes the static value to a dynamic value)
And Yes this was possible, so instead of using a custom function I can simply compare two static values because somewhere in the core of toolset all string values gets rendered in case they hold a short code.
Now this can be a security bug because you are able to execute short codes without registering them, but it could also be the way the system is designed on purpose, and I will be able to expect this behaviour to continue going on forward.
Either way I need to know if its a bug or a feature, that parameter strings gets rendered if they include a short code, which is the same scenario for static values.
Please see this video for an illustration.
hidden link
Cheers.