• Resolved thomasperalta

    (@thomasperalta)


    Hi Michael,

    I’m creating a website for a new foundation and I am absolutely loving Kudos so far – thank you for putting so much work into this awesome plugin!

    For recurring donations, I have a question about the donation duration dropdown. I was wondering if it’s possible to use filters on the duration dropdown similar to the existing filter for payment frequency, such that we can choose which durations to show?

    Or even better for my specific case: is it possible to make “continuous” the default option for the donation duration without letting donors make a different choice? That means I wouldn’t even need to show the duration dropdown – by default it is just set to continuous for everyone.

    Curious if others also see value in this and how hard it would be to implement technically.

    Thanks for letting me know!
    Best regards,
    Thomas

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Michael Iseard

    (@iseardmedia)

    Hi @thomasperalta

    I am glad you are enjoying Kudos and thanks for the positive feedback!

    Actually there is a filter included in the upcoming version, as it is a relatively big update it has taken a while to make sure it all works. It is pretty close to release now and should be quite stable. I would actually love some feedback if you have time.

    You can find the latest beta here: https://github.com/mikey242/kudos-donations/releases

    The filter you want is called kudosFormDuration and is a javascript-based filter. Here is an example of how to use it:

    import { addFilter } from '@wordpress/hooks';

    addFilter(
    'kudosFormDuration',
    'my-plugin/kudos-duration',
    ( options ) => {
    // Example: limit to 1, 2, and 5 years only
    return options.filter( ( option ) =>
    [ 1, 2, 5 ].includes( option.value )
    );
    }
    );

    If you prefer to just put it in the functions.php file you could do it like this:

    add_action(
    'wp_enqueue_scripts',
    function () {
    wp_add_inline_script(
    'kudos-view-script', // adjust to match the actual script handle.
    "
    wp.hooks.addFilter(
    'kudosFormDuration',
    'my-plugin/kudos-duration',
    function( options ) {
    // Only keep Continuous (0)
    return options.filter( function( option ) {
    return option.value === 0;
    } );
    }
    );
    "
    );
    }
    );

    Remember this filter will only work with Kudos Donations from version 4.2.0 and up.

    Grateful for any feedback and I hope this helps!

    Kind regards,
    Mike

    Thread Starter thomasperalta

    (@thomasperalta)

    Hi Mike,

    Thanks for the fast reply! I actually had a bit of time today so I played around with 4.2.0-beta10. See some comments and questions below:

    – All my data and settings were saved perfectly after deleting 4.1.6. and uploading 4.2.0-beta10.

    – The main visual difference I see in the embedded form is that the form looks wider than before. I personally prefer the form being a bit less wide as it was in 4.1.6. This only applies to desktop – on mobile it looks the same as before.

    – I didn’t have time to check any features related to payment status or emails and invoices etc.

    – I used WP Code Snippets to add the second piece of code you sent. It seems to be working perfectly as only “Continuous” is now shown as duration option. My only worry with this is whether it’s user friendly to leave only one option in the dropdown. It gives them the illusion of a choice when there isn’t really a choice at all haha. Do you think it’s possible to create an option in the backend where we can completely remove the duration dropdown and the duration is automatically set to “Continuous” for all donors? Understandable if this is a big ask – just curious 🙂

    – Another thing I noticed: I hadn’t actually used filters before but I was interested in using the one for payment frequency as well because I am considering to only allow monthly and yearly (so disabling quarterly). I used the code from your documentation (also in WP Code Snippets), but it doesn’t seem to be working for me. I thought it was related to 4.2.0-beta10 but it’s actually also not working in 4.1.6 for me. I might be doing something wrong because I am quite new to using hooks, but it might be worth for you to check this. The code I used is below:

    function kudos_change_frequency_options( array $options ) {
    unset($options['3 months']); // Disable Quarterly.
    return $options;
    };
    add_filter('kudos_frequency_options', 'kudos_change_frequency_options');

    Thanks again for the quick reply and let me know if there is anything else I can check.
    I’m hoping my website will go live mid-March – do you have an indication of whether you will update Kudos before that time? Or do you expect it will be safer for me to go back to 4.1.6 for the launch?

    Cheers,
    Thomas

    Plugin Author Michael Iseard

    (@iseardmedia)

    Hi Thomas,

    Thanks for your feedback. The visual difference you mention is interesting, you could try changing the base font size and see if it gives a better result. You can find this setting in Settings > Help > Advanced. The base font size only effect Kudos and is used to basically scale the entire interface, not just the font size. If that doesn’t help you can always try to use some custom css to make it narrower (this needs to be entered under the custom css tab of a campaign):

    #container {
        max-width: 500px;
        margin: auto;
    }

    The kudosFormDuration filter was only really designed to modify the options available, but you are right that it is not very user friendly to have a drop-down with only one option. I will consider your feedback here and see if it is feasible to add this feature later.

    The old filter for kudos_frequency_options was a bit buggy in older versions, it only worked in specific circumstances so it has been replaced in 4.2.0 with kudosFormFrequencyOptions which is again a JavaScript hook. Here is an example of how to use it:

    import { addFilter } from '@wordpress/hooks';

    addFilter(
    'kudosFormFrequencyOptions',
    'my-plugin/remove-quarterly',
    ( options ) => {
    const filtered = { ...options };
    delete filtered['3 months'];
    return filtered;
    }
    );

    The 4.2.0 beta is pretty solid now and will be released within the next few weeks hopefully (pending some more feedback). I would say stick with it since it contains quite a few important improvements and bug fixes. Once the final release is available you will see the update in WordPress and can update from your current beta.

    Happy to hear any other feedback you have for 4.2.0 and good luck with the foundation!

    Kind regards,
    Mike

    Thread Starter thomasperalta

    (@thomasperalta)

    Hi Mike,

    The css works perfectly to make it narrower, thank you.

    For “kudosFormFrequencyOptions”, do you also have the code to add it to functions.php instead?

    Finally I noticed one more thing while testing that I wanted to mention to you. Previously when I was testing donations (Mollie test mode, so not live), when I manually stopped a donation by going back from Mollie’s payment interface to my website without completing the payment, a Kudos pop-up would appear with a message to show that the payment was not successful. But this time I was actually sent to the “thank you” page on my website that I link to after successful payments. I’m not sure if it’s because I am in test mode or if it has to do with the Beta version of Kudos – just thought I would share.

    Thanks again for all your help!

    Cheers,
    Thomas

    Plugin Author Michael Iseard

    (@iseardmedia)

    Hi Thomas,

    The php filter follows the same format as the first one, just swapping the filter name and the logic to remove ‘3 months’:

    add_action(                                                                                                                                                                      
    'wp_enqueue_scripts',
    function () {
    wp_add_inline_script(
    'kudos-view-script',
    "
    wp.hooks.addFilter(
    'kudosFormFrequencyOptions',
    'my-plugin/remove-quarterly',
    function( options ) {
    // Remove quarterly from options.
    var filtered = Object.assign( {}, options );
    delete filtered['3 months'];
    return filtered;
    }
    );
    "
    );
    }
    );

    As for the canceled payment not showing the modal, the difference should be down to your campaign settings. If you don’t have the modal enabled (to show a thank you message) then it will also not show a payment canceled message.

    The difficult here is that Kudos does not know whether the payment was successful usually until just after the user is returned to the website (sometimes it can take around 5 seconds for Mollie to ping back and notify what the result was). The pop-up modal actually polls for the status update and shows the result once completed.

    The modal should work with the custom return URL as long as it is to the same website. If you have both enabled and the return URL is to the same website then there may be a bug so let me know.

    Kind regards,
    Mike

    Thread Starter thomasperalta

    (@thomasperalta)

    Hi Mike,

    Thanks again for the PHP filter and explaining how the pop-up modal works. I was indeed only using the custom thank you page without the pop-up modal.

    There is one final thing I noticed while making my first real donation using the live API key. It all worked perfectly but I noticed in the confirmation email that the name of my foundation was displayed weirdly. There is an apostrophe in the name which was displayed as “'”. Is that something that is easy to fix?

    No other feedback on 4.2.0 so far – curious to hear when it goes live!

    Cheers,
    Thomas

    Plugin Author Michael Iseard

    (@iseardmedia)

    Hi Thomas,

    Glad to hear the filter is working!

    Thanks for your bug report, the fix is very easy so I included it in the next beta which is now available here: https://github.com/mikey242/kudos-donations/releases

    I’ll mark this thread as resolved for now, but please feel free to reply with any more suggestions or feedback.

    Thanks again!
    Mike

    Thread Starter thomasperalta

    (@thomasperalta)

    Hi Mike,

    2 quick questions again from me 🙂

    – I’m looking into caching my website to make it faster for visitors. I am wondering if it is safe for me to cache my donation page as well, or if it will cause issues for the embedded donation form. Do you have any experience with this?
    – My website will go live next Wednesday March 25th. Do you recommend me to update to the latest beta before going live, or do you expect your next update will go live before that so I can update directly from the plugin page?

    Thanks in advance,
    Thomas

    Plugin Author Michael Iseard

    (@iseardmedia)

    Hi Thomas,

    There are lot’s of different types of caching that you can use (OPcache, Object, Asset, Page caching). Bugs can occur but this is expected by the caching plugins which generally include many options to tweak it for your specific setup.

    Let me know which plugin and settings you are planning to use and I can take a look when I have some time to let you know. Otherwise the best way to ensure it is all working is to just test it as a non-logged-in user since many of these plugins work differently depending on whether you are logged-in or not.

    There will probably be at least another beta before the final update so I recommend updating to the latest beta for now.

    Kind regards,
    Mike

Viewing 9 replies - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.