• Resolved fohly

    (@fohly)


    Dear Nicolas,

    just starting to use your plugin, great work – thank you! As I am figuring out your hooks, there is one thing I do not manage to do yet.
    I would like to dynamically create the button parameters via general shortcode attributes instead via the value=”…” attribute. For most parameters that works fine, but not for the attribute tc=”…” which I would like to use to have the terms&conditions checkbox display. That means I would like to use a shortcode att like in [direct-stripe … tc=”1″] to make the terms&conditions checkbox appear.

    Currently that does not work due to the code in ds-button.php:

    //T&C Check box condition
        if( isset( $ds_button->tc ) && $ds_button->tc === true ||

    Unfortunately I cannot pass a shortcode attributes as type boolean, it is always type string. So the comparison $ds_button->tc === true will always fail, if I use a shortcode like [direct-stripe … tc=”1″] . It works without type enforcement, i.e. with $ds_button->tc == true (with only two equal signs).

    Would there be any unwanted side effects by changing the code like this? If not, would you be willing to turn the === to == in your code?

    Kind regards
    Florian

Viewing 1 replies (of 1 total)
  • Plugin Author Nicolas Figueira

    (@nahuelmahe)

    Hello Florian,

    Thank you for using Direct Stripe.

    And thank you for noticing that behaviour, the issue comes from the t&c general option having been removed. If you look at the second part of the condition after the || you”ll notice that you’re shortcode attribute would have worked if the general option for t&c was enabled, but I removed it to make t&c option a button based option only, my bad. I’m sorry about that.

    The condition should be reduced to :
    isset( $ds_button->tc ) && $ds_button->tc !== false

    I pushed that change to the develop branch on Github ( https://github.com/New0/direct-stripe/tree/develop ), you can download the plugin ad a zip at that url and replace it in you WordPress environment. This is the only change made since last version pushed to www.ads-software.com repo.

    I will push that change in the next update, thank you again for noticing that issue.

    Also about your comment, a non empty string except “0” returns true when evaluated as a boolean ( php.net/manual/language.types.boolean.php ).

    Let me know if you need help with hooks, best wishes.

    Nicolas

Viewing 1 replies (of 1 total)
  • The topic ‘Feature: Allow Shortcode Att for T&C Display’ is closed to new replies.