• Resolved mtrehearn

    (@mtrehearn)


    Hi there,

    First off great plugin – I love it.

    I am trying to implement it on my site and it is all fine but I need to bare the GDPR in mind. I have added the check box under the Terms and Conditions settings and again it all works but I wondered if the consent was saved anywhere? The reason being is that if I needed to prove consent was given I would like to be able to export the time, date, consent wording and maybe even IP address along with all of the other information taken on the donation form. This would make it a little more all encompassing in terms of data request.

    Thanks for your help.

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Matt Cromwell

    (@webdevmattcrom)

    HI there,

    That’s a valid request which we have not yet worked out in Give Core out of the box. But this snippet here will save your Terms Agreement text to your donation meta, which will then be accessible via our Give Donations Export tool as well.

    https://github.com/impress-org/give-snippet-library/blob/master/form-customizations/gdpr-save-terms-to-donation-meta.php

    If you need guidance implementing custom PHP functions on your website, we have this guide here: https://givewp.com/documentation/resources/adding-custom-functions-to-your-wordpress-website/

    The Give Donations Export tool already exports the IP Address and Date, this simply also adds that consent was given and the unique Terms and Conditions text per form as well.

    Try that out and let me know if you have additional questions. Thanks!

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    Not sure if you saw this yesterday, but I made my final tweaks to the snippet. It’s working as intended now whether you customize the text or are using the global settings.

    Additionally, I created an issue for our development team to look into this and see if we might incorporate this into Give Core. You can follow our progress on that here:
    https://github.com/impress-org/give/issues/4055

    Thanks!

    mtrehearn

    (@mtrehearn)

    Hi,

    Sorry based in UK so only just seen this.

    Thank you for your help. My Custom Functions plugin doesn’t agree with my site for some reason and just freezes so trying to find other ways to implement code without hacking up my functions.php file.

    What I was really after is just adding a column at the end that is titled something like “Consent” where it will add the “I agree to the terms text”. For ease this doesn’t have to take the value from the settings page but can just be typed for now. Any ideas how I can do that and add a column?

    Also I wondered if there was a way to export the data of just one donor that can be found perhaps using email address rather than a number of donors based on a date range? Reason being is if I want to send the csv file for a donor if they request their details I’ll have to manually go in and delete all other details for donors within that date range. Not a big issue as it’s something that will rarely come up but just curious if it’s do-able?

    Thanks again for the help.

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    1) Regarding My Custom Functions — that used to be problematic years ago. Have you tried it recently? Other than that, your child theme’s functions.php file is the only other recommended place for snippets like that.

    You can try this one, but the reason I don’t recommend it is that it doesn’t have fatal error checking and prevention like My Custom Functions does
    https://wordpress.org/plugins/functionality/

    2) I think the snippet I provided is the best route since you are already implementing the Terms and Conditions checkbox that IS itself the consent box. Once that snippet is installed you’ll get all the info you need in your report.

    The reason it gets those settings is because the Terms can be set per form or globally, so the snippet checks for either — that’s important if others plan to use this snippet as well.

    But the other reason why it’s pulling that is because currently the text is NOT saved to the donation at all, so that’s why this has to be there, so that that consent and text gets saved to the donations and is then available via the Export.

    Once you have that snippet, and you go to the “Donation Export” tool, choose the form you from which you want to export the donations and you’ll see a “Custom Fields” section show up, which you select and then you’ll have all the information you need.

    3) That’s not currently do-able unfortunately. We are working on a very new form builder and report API. As we build those out, we’ll be keeping these types of privacy concerns front and center which should result in much more flexible ways to support the needs you have.

    Thanks!

    mtrehearn

    (@mtrehearn)

    Hi,

    1. Yeh it was a fresh install of the plugin so not sure what happened there. I have added it to the functions.php in my child theme now instead but it has an issue with the “{” on line 33 just above the code:

    add_action(‘give_after_donation_levels’, ‘custom_givewp_output_terms_for_saving’);

    2. That makes a lot of sense and would be helpful for others looking for a similar solution.

    3. That’s ok – its not a big problem – the work around for now is to download the CSV file and manually delete the details of other donors to prevent accidentally leaking their details before sending to the donor that requested the data we hold on them.

    Thanks again for the help.

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    Can you provide a screenshot of how you implemented the code in your functions.php file? The snippet on Github is correct as far as I can see.

    mtrehearn

    (@mtrehearn)

    Hi there,

    This is what is in my child theme’s functions.php. Obviously just ignore the first couple of functions / filters.

    Thanks,

    <?php

    add_action( ‘wp_enqueue_scripts’, ‘enqueue_parent_styles’ );

    function enqueue_parent_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri().’/style.css’ );
    }

    // changes the “select options” text. Forget who to give credit to for this.
    add_filter( ‘woocommerce_product_add_to_cart_text’, function( $text ) {
    global $product;
    if ( $product->is_type( ‘variable’ ) ) {
    $text = $product->is_purchasable() ? __( ‘Options’, ‘woocommerce’ ) : __( ‘Read more’, ‘woocommerce’ );
    }
    return $text;
    }, 10 );

    /**
    * remove add to cart buttons on shop archive page
    */

    add_filter( ‘woocommerce_loop_add_to_cart_link’, ‘replacing_add_to_cart_button’, 10, 2 );
    function replacing_add_to_cart_button( $button, $product ) {
    if ( $product->is_type( ‘simple’ ) ) {
    $button_text = __(“View”, “woocommerce”);
    $button = ‘get_permalink() . ‘”>’ .
    $button_text . ‘
    ‘;
    }
    return $button;
    }

    /**
    4 * Add Terms Agreement text and consent to Donation Meta
    5 * NOTE: This is then used in the Give CSV Export to show consent.
    6 *
    7 */

    /**
    10 * Output Terms in hidden textarea for saving
    11 *
    12 * @param $form_id
    13 */
    function custom_givewp_output_terms_for_saving($form_id) {

    $formmeta = get_post_meta($form_id);
    $terms_enabled = $formmeta[‘_give_terms_option’][0];
    $global = give_get_settings();

    switch($terms_enabled) {
    case ‘enabled’: $terms = $formmeta[‘_give_agree_text’][0]; break;
    case ‘global’: $terms = $global[‘agreement_text’]; break;
    default: return;
    }

    if ( $terms_enabled!==’disabled’ ) {
    ?>
    <textarea class=”give-textarea” name=”give_form_terms” id=”give_form_terms” aria-hidden=”true”
    style=”display:none;opacity: 0; height: 0; border: 0 !important;” readonly disabled><?php echo $terms; ?></textarea>
    <?php
    }

    }

    add_action(‘give_after_donation_levels’, ‘custom_givewp_output_terms_for_saving’);

    /**
    39 * Save Terms and Terms Agreement in to donation meta
    40 *
    41 * @param $form_id
    42 */

    function custom_give_save_terms_agreement_to_donation_paymentmeta( $payment_id ) {
    global $post;

    if ( isset($_POST[‘give_agree_to_terms’]) ) {
    $agreed = wp_strip_all_tags( $_POST[‘give_agree_to_terms’], true );
    $terms = wp_strip_all_tags( $_POST[‘give_form_terms’], true );
    $pretty_terms = ( $terms == 1 ) ? __(‘Yes’, ‘give’) : __(‘No’,’give’);

    give_update_payment_meta( $payment_id, ‘give_form_terms’, $pretty_terms );
    give_update_payment_meta( $payment_id, ‘give_agree_to_terms’, $agreed );

    }
    }

    add_action(‘give_insert_payment’, ‘custom_give_save_terms_agreement_to_donation_paymentmeta’);

    ?>

    Hi,

    Just wondered if you had a chance to look at this at all yet please?

    Thank you.

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    Sorry… didn’t see your replies come through. In looking at your snippet now, make sure you remove all those numbers at the beginning of the lines.

    For example, this:

    /**
    4 * Add Terms Agreement text and consent to Donation Meta
    5 * NOTE: This is then used in the Give CSV Export to show consent.
    6 *
    7 */
    
    /**
    10 * Output Terms in hidden textarea for saving
    11 *
    12 * @param $form_id
    13 */

    Should actually be this:

    /**
      * Add Terms Agreement text and consent to Donation Meta
      * NOTE: This is then used in the Give CSV Export to show consent.
      *
      */
    
    /**
      * Output Terms in hidden textarea for saving
      *
      * @param $form_id
      */

    Try that and let me know how it goes.

    Hi,

    Thanks for the reply.

    There doesn’t appear to be any issues with code being thrown up but there’s no option for “Custom Fields” i can see when i go to download the CSV.

    Thanks for the help.

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    I believe you’ll need to do at least one test donation with a form that has that information on it already before it appears as in the Export. That field in the export only appears when the new donation meta is present in the database.

    Thanks!

    Hi,

    Thanks for the reply. I have done a couple of dummy offline donations on an existing form I have and marked them as “complete” but when I go to export the csv (the first / top option) then there is no option for custom fields and the csv stops at IP address.

    Thanks for the help.

    Hi,

    Just wondered if you had a chance to look at this at all please?

    Thank you.

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    Hi there,

    I’m sorry, I’m not sure what to look at. The snippet I provided I spent quite a bit of time on to ensure it works as intended. I confirmed that it saves the data correctly, and that when you go to do the “Export Donations” tool, choose the form that you want to export, and after that form is chosen, you’ll see the “Custom Fields” show up towards the bottom of the screen, and you’ll be able to choose the custom fields to export. I’ve tested and confirmed this multiple times, but I’ll ask another colleague to test as well.

    Hi,

    Thank you for looking in to this.

    I have tried every way I can think of – just your code in my functions.php, using the global and custom terms on the plugin etc. – and I just can’t see what’s going wrong / what I’m missing.

    As a work around is there any way to add a column to the end of the output csv titled “consent” and just input the text I want (I.e. my wording for the “I accept the terms” text) as plain text in the row below?

    Thanks again for the help – I appreciate everything you are trying to do 🙂

Viewing 15 replies - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.