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 to see the link]
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Adding Memo Section for users’ is closed to new replies.