Here it is without quote destruction. It only worked for me when I was brave about substituting any value=””.
function gsdoc_get_user_email( $form ) {
if( is_user_logged_in() ){
global $wpdb;
$current_user2 = wp_get_current_user();
$pol1 = 'value=""';
$pol2 = 'value="' . $current_user2->user_email . '"';
$form = str_replace($pol1, $pol2, $form);
return $form;
}
}
add_filter( 'mailpoet_form_widget_post_process', 'gsdoc_get_user_email' );
-
This reply was modified 4 years, 3 months ago by bimargulies.
-
This reply was modified 4 years, 3 months ago by bimargulies.