Title: Adding Memo Section for users
Last modified: May 2, 2018

---

# Adding Memo Section for users

 *  Resolved [imthatguydavid](https://wordpress.org/support/users/imthatguydavid/)
 * (@imthatguydavid)
 * [8 years ago](https://wordpress.org/support/topic/adding-memo-section-for-users/)
 * I have created a memo section for the give plugin, but it doesn’t seems to appear
   in the wp-admin section.
 * Was wondering if someone can look at what is wrong with my code.
 *     ```
       /**
        * Add Custom Donation Form Fields
        *
        * @param $form_id
        */ 
       function give_myprefix_custom_form_fields( $form_id ) {
       	// Only display for forms with the IDs "754" and "578";
       	// Remove "If" statement to display on all forms
       	// For a single form, use this instead:
       	// if ( $form_id == 754) {
       	$forms = array( 754, 578 ); ?>
       		<div id="give-memo-wrap">
       			<label class="give-label" for="give-memo"><?php _e( 'Memo:', 'give' ); ?>		<span class="give-tooltip icon icon-question" data-tooltip="<?php _e( 'Comment section for your donation', 'give' ) ?>"></span>
       			</label>
       			<textarea class="give-textarea" name="give_memo" id="give-memo"></textarea>
       		</div>
       	<?php 
       // endif; 
       } 
   
       add_action( 'give_after_donation_levels', 'give_myprefix_custom_form_fields', 10, 1 );
   
       /**
        * Add Field to Payment Meta
        *
        * Store the custom field data custom post meta attached to the <code>give_payment</code> CPT.
        *
        * @param $payment_id
        * @param $payment_data
        *
        * @return mixed
        */
       function myprefix123_give_donations_save_custom_fields( $payment_id, $payment_data ) {
             if ( isset( $_POST['give_memo'] ) ) {
       		$message = implode( "\n", array_map( 'sanitize_text_field', explode( "\n", $_POST['give_memo'] ) ) );
       		add_post_meta( $payment_id, 'give_memo', $message );
       	}
       }
   
       add_action( 'give_insert_payment', 'myprefix123_give_donations_save_custom_fields', 10, 2 );
   
       /**
        * Show Data in Payment Details
        *
        * Show the custom field(s) on the payment details page in wp-admin
        *
        * @param $payment_id
        */
       function give_myprefix_purchase_details( $payment_id ) {
       	// Bounce out if no data for this transaction
       	$give_memo = give_get_meta( $payment_id, 'give_memo', true );
               if ( $give_memo ) : ?>
       	<div id="give-memo-details" class="postbox">
                   <h3 class="hndle"><?php esc_html_e( 'Memo Message', 'give' ); ?></h3>
                   <div class="inside" style="padding-bottom:10px;">
                       <?php echo wpautop( $give_memo ); ?>
                   </div>
               </div>
   
               <?php endif;
        } 
   
       add_action( 'give_payment_personal_details_list', 'give_myprefix_purchase_details', 10, 2 );
       ```
   
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fadding-memo-section-for-users%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Contributor [Matt Cromwell](https://wordpress.org/support/users/webdevmattcrom/)
 * (@webdevmattcrom)
 * [8 years ago](https://wordpress.org/support/topic/adding-memo-section-for-users/#post-10240652)
 * In the last line of your code, change the action from `give_payment_personal_details_list`
   to `give_view_donation_details_billing_before`
 * Let me know how that goes.
 *  Thread Starter [imthatguydavid](https://wordpress.org/support/users/imthatguydavid/)
 * (@imthatguydavid)
 * [8 years ago](https://wordpress.org/support/topic/adding-memo-section-for-users/#post-10240861)
 * Thanks for the reply! didn’t seem to work.
 * it’s still not showing up in wp-admin.
    -  This reply was modified 8 years ago by [imthatguydavid](https://wordpress.org/support/users/imthatguydavid/).
 *  [Deepak Gupta](https://wordpress.org/support/users/raftaar1191/)
 * (@raftaar1191)
 * [8 years ago](https://wordpress.org/support/topic/adding-memo-section-for-users/#post-10241665)
 * Hey [@imthatguydavid](https://wordpress.org/support/users/imthatguydavid/) Kindly
   try this code and let me know if this is working for you or not
 *     ```
       /**
        * Add Custom Donation Form Fields
        *
        * @param $form_id
        */
       function give_myprefix_custom_form_fields( $form_id ) {
       	// Only display for forms with the IDs "754" and "578";
       	// Remove "If" statement to display on all forms
       	// For a single form, use this instead:
       	// if ( $form_id == 754) {
       	$forms = array( 754, 578 ); ?>
       	<div id="give-memo-wrap">
       		<label class="give-label" for="give-memo"><?php _e( 'Memo:', 'give' ); ?> <span
       				class="give-tooltip icon icon-question"
       				data-tooltip="<?php _e( 'Comment section for your donation', 'give' ) ?>"></span>
       		</label>
       		<textarea class="give-textarea" name="give_memo" id="give-memo"></textarea>
       	</div>
       	<?php
       // endif;
       }
   
       add_action( 'give_after_donation_levels', 'give_myprefix_custom_form_fields', 10, 1 );
   
       /**
        * Add Field to Payment Meta
        *
        * Store the custom field data custom post meta attached to the <code>give_payment</code> CPT.
        *
        * @param $payment_id
        * @param $payment_data
        *
        * @return mixed
        */
       function myprefix123_give_donations_save_custom_fields( $payment_id, $payment_data ) {
       	if ( isset( $_POST['give_memo'] ) ) {
       		$message = implode( "\n", array_map( 'sanitize_text_field', explode( "\n", $_POST['give_memo'] ) ) );
       		give_update_meta( $payment_id, 'give_memo', $message );
       	}
       }
   
       add_action( 'give_insert_payment', 'myprefix123_give_donations_save_custom_fields', 10, 2 );
   
       /**
        * Show Data in Payment Details
        *
        * Show the custom field(s) on the payment details page in wp-admin
        *
        * @param $payment_id
        */
       function give_myprefix_purchase_details( $payment_meta ) {
       	$payment_id = absint( $_GET['id'] );
   
       	// Bounce out if no data for this transaction
       	$give_memo = give_get_meta( $payment_id, 'give_memo', true );
   
       	if ( $give_memo ) : ?>
       		<div id="give-memo-details" class="postbox">
       			<h3 class="hndle"><?php esc_html_e( 'Memo Message', 'give' ); ?></h3>
       			<div class="inside" style="padding-bottom:10px;">
       				<?php echo wpautop( $give_memo ); ?>
       			</div>
       		</div>
   
       	<?php endif;
       }
   
       add_action( 'give_payment_personal_details_list', 'give_myprefix_purchase_details', 10 );
       ```
   
 * Thanks
    Deepak
 *  Thread Starter [imthatguydavid](https://wordpress.org/support/users/imthatguydavid/)
 * (@imthatguydavid)
 * [8 years ago](https://wordpress.org/support/topic/adding-memo-section-for-users/#post-10245195)
 * Wow Thanks! Works perfectly!

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

The topic ‘Adding Memo Section for users’ is closed to new replies.

 * ![](https://ps.w.org/give/assets/icon-256x256.jpg?rev=2873287)
 * [GiveWP - Donation Plugin and Fundraising Platform](https://wordpress.org/plugins/give/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/give/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/give/)
 * [Active Topics](https://wordpress.org/support/plugin/give/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/give/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/give/reviews/)

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * 4 replies
 * 3 participants
 * Last reply from: [imthatguydavid](https://wordpress.org/support/users/imthatguydavid/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/adding-memo-section-for-users/#post-10245195)
 * Status: resolved