• Resolved justyumyum

    (@justyumyum)


    Hi there,

    I’ve written a little script that adds a “fallback” Contact 7 form automatically to a specific post type (see script below). To avoid that this form is display with an empty user_email parameter I would like to add a check if a value for user_mail has been set or not.

    How could this been done?

    Thanks and best regards
    Carsten

    add_action('genesis_before_comments','jyyAddContactForm');
    
    function jyyAddContactForm(){
      	global $post;
    	if (has_shortcode($post->post_content, 'contact-form-7') && is_singular('event')){
    	  	// nothing
    		} else {
    			echo(do_shortcode('[contact-form-7 id="1085" title="Kontaktformular mit Dynamic Email Recipient"]'));
    			}
    }
    • This topic was modified 7 years, 3 months ago by justyumyum.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter justyumyum

    (@justyumyum)

    Ok, got it by myself!

    $jyy_checkUserEmail = get_post_meta(get_the_ID(),'user_email', true);

    is doing the magic

Viewing 1 replies (of 1 total)
  • The topic ‘Check if user_mail is set’ is closed to new replies.