• Hello!

    Is it possible to add a message box to the donation form? So when people give an amount, they can write a message along with it?

    I would just want the box to say ‘Your Message’ and the content to be kept with their donation profile. Is this possible?

    I would really appreciate your help!

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • This is an excellent general suggestion, and I just want to say I’d like to see this also.

    One of the features I’d like to have on my site, which Give doesn’t support very well, is the ability to make a ‘Tribute’ gift. This could be a donation In Memory of someone. A general text box would be very useful in us supporting this feature.

    Thanks,

    Mike

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    HI @laurenandchris and @mhartste

    You’re looking to add custom fields to the Give form. That can be done in one of two ways:

    Thanks!

    Plugin Author Devin Walker

    (@dlocc)

    Also, FYI – we’re going to release an official Add-on for Dedications / In Memory / In Honor of… this next year so keep a lookout for that!

    This is great, Devin. I will look forward to that add-on!

    I hope it will support the following:
    – Not just deaths, but also contributions for other occasions (sometimes people suggest a donation instead of a birthday present, etc.)
    – The option to send an additional email to another person (besides the confirmation email to the donor, another email to the birthday boy, next-of-kin, etc.)
    – The ability to specify the amount donated, or to not specify the amount on the additional email
    – The ability to add a personalized message on the additional email

    Thanks,

    Mike

    Thread Starter laurenandchris

    (@laurenandchris)

    Hi @webdevmattcrom!

    Thank you for your message, you’re always so helpful – I genuinely appreciate it. I’ve been trying to make the coding work and am having some trouble, when I add it using the My Custom Functions plug in, it comes up with a fatal error. I tried to change the code to be what I want it to say… I just want a simple box that says ‘Your Message:’ on ALL forms. Are you able to provide any further help or insight into what I need to paste into My Custom Functions to make this work? I would be SO grateful for any help.

    Here is the code I was trying to use (it was copied from your documentation, then I changed the text where I thought to have it read ‘Your Message:’

    /** * Custom Form Fields * * @param $form_id */ function give_myprefix_custom_form_fields( $form_id ) { //Only display for a specific form; //Remove “If” statement to display on all forms if ( $form_id == ‘754’ ) { ?> <div id=”give-referral-wrap”> <label class=”give-label” for=”give-referral”><?php _e( ‘Your message:’, ‘give’ ); ?></label> <span class=”give-tooltip icon icon-question” data-tooltip=”<?php _e( ‘Please take a moment to write a personal message’, ‘give’ ) ?>”></span> <textarea class=”give-textarea” name=”give_referral” id=”give-referral”></textarea> </div> <?php }//endif } add_action( ‘give_after_donation_levels’, ‘give_myprefix_custom_form_fields’, 10, 1 ); /** * Validate Custom Field * * @description check for errors without custom fields * * @param $valid_data * @param $data */ function give_myprefix_validate_custom_fields( $valid_data, $data ) { //Check that we’re validating the proper form //Remove if this is a global field if ( $data[‘give-form-id’] !== ‘754’ ) { return; } //Check for a referral data if ( empty( $data[‘give_referral’] ) ) { give_set_error( ‘give_referral’, __( ‘Please take a moment to write a personal message’, ‘give’ ) ); } } add_action( ‘give_checkout_error_checks’, ‘give_myprefix_validate_custom_fields’, 10, 2 ); /** * Add Field to Payment Meta * * @description store the custom field data in the payment meta * * @param $payment_meta * * @return mixed */ function give_myprefix_store_custom_fields( $payment_meta ) { $payment_meta[‘referral’] = isset( $_POST[‘give_referral’] ) ? implode( “n”, array_map( ‘sanitize_text_field’, explode( “n”, $_POST[‘give_referral’] ) ) ) : ”; return $payment_meta; } add_filter( ‘give_payment_meta’, ‘give_myprefix_store_custom_fields’ ); /** * Show Data in Transaction Details * * @description show the custom field(s) on the transaction page * * @param $payment_meta * @param $user_info */ function give_myprefix_purchase_details( $payment_meta, $user_info ) { //uncomment below to see payment_meta array // echo “

    "; // var_dump($payment_meta); // echo "

    “; //Bounce out if no data for this transaction if ( ! isset( $payment_meta[‘referral’] ) ) { return; } ?> <div class=”referral-data”> <label><?php echo __( ‘Referral:’, ‘give’ ); ?></label> <?php echo wpautop( $payment_meta[‘referral’] ); ?> </div> <?php } add_action( ‘give_payment_personal_details_list’, ‘give_myprefix_purchase_details’, 10, 2 );

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add message box to donation form’ is closed to new replies.