• Resolved asuccurro

    (@asuccurro)


    Hello,

    I built a form with Gutenverse form, setup SMTP and created a form action that sends a confirmation email to the person filling the form. It works fine but the email contains the whole form entries and I would like to remove all or part of them. However I cannot find anywhere how to do so, I can only modify the “intro” text. How can I select which entries get sent with the confirmation email?

    Thanks,
    Antonella

Viewing 3 replies - 1 through 3 (of 3 total)
  • Pradnya

    (@pradnyajegstudio)

    Hi Antonella,

    We don’t have the option to select which entries get sent through the form settings. However, if you’re comfortable editing the code, you can use this filter. Kindly place the entries check within the condition I have commented on.

    add_filter(
    	'gutenverse_form_format_data',
    	function( $data_html, $form_id, $form_entry, $entry_id, $admin ) {
    		ob_start();
    		?>
    		<div>
    			<table width="100%" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF" style="border: 1px solid #EAF2FA">
    				<tbody>
    					<?php
    					if ( $admin ) {
    						echo "<tr bgcolor='#EAF2FA'><td colspan='3'><strong>" . esc_html__( 'Form ID', 'gutenverse' ) . '</strong></td></tr>';
    						echo "<tr bgcolor='#FFFFFF'><td width='20'>" . esc_html( $form_id ) . '</td></tr>';
    						echo "<tr bgcolor='#EAF2FA'><td colspan='3'><strong>" . esc_html__( 'Post ID', 'gutenverse' ) . '</strong></td></tr>';
    						echo "<tr bgcolor='#FFFFFF'><td width='20'>" . esc_html( $form_entry['post-id'] ) . '</td></tr>';
    					}
    
    					echo "<tr bgcolor='#EAF2FA'><td colspan='3'><strong>" . esc_html__( 'Entry ID', 'gutenverse' ) . '</strong></td></tr>';
    					echo "<tr bgcolor='#FFFFFF'><td width='20'>" . esc_html( $entry_id ) . '</td></tr>';
    					echo "<tr bgcolor='#EAF2FA'><td colspan='3'><strong>" . esc_html__( 'Entry Data', 'gutenverse' ) . '</strong></td></tr>';
    
    					foreach ( $form_entry['entry-data'] as $data ) {
    						// Select which entries get sent.
    						if ( in_array( $data['id'], array( 'input-email' ) ) ) {
    							$value = is_array( $data['value'] ) ? gutenverse_join_array( $data['value'], false ) : $data['value'];
    
    							echo "<tr bgcolor='#FFFFFF'><td colspan='2'><strong>" . esc_html( $data['id'] ) . '</strong></td>';
    							echo "<td width='20'>" . esc_html( $value ) . '</td></tr>';
    						}
    					}
    
    					if ( $admin && ! empty( $form_entry['browser-data'] ) ) {
    						echo "<tr bgcolor='#EAF2FA'><td colspan='3'><strong>" . esc_html__( 'Browser Info', 'gutenverse' ) . '</strong></td></tr>';
    						echo "<tr bgcolor='#FFFFFF'><td colspan='2'><strong>IP Address</strong></td>";
    						echo "<td width='20'>" . esc_html( $form_entry['browser-data']['ip'] ) . '</td></tr>';
    						echo "<tr bgcolor='#FFFFFF'><td colspan='2'><strong>Browser Data</strong></td>";
    						echo "<td width='20'>" . esc_html( $form_entry['browser-data']['user_agent'] ) . '</td></tr>';
    					}
    
    					?>
    				</tbody>
    			</table>
    		</div>
    		<?php
    		$data_html = ob_get_contents();
    		ob_end_clean();
    
    		return $data_html;
    	},
    	10,
    	5
    );
    Thread Starter asuccurro

    (@asuccurro)

    Hello Pradnya,

    thank you for the answer, yes I am comfortable in changing some code but I have difficulties in locating the file where the filter should go, is it gutenverse/includes/class-form.php ? And after which function?

    Thanks,

    Antonella

    Pradnya

    (@pradnyajegstudio)

    You can add it to your theme’s functions.php file. Typically, people create a child theme to incorporate the hook functions. Could you please inform me of the theme you are currently using?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Edit confirmation email content (gutenverse form)’ is closed to new replies.