• Resolved fazzarrell

    (@fazzarrell)


    I have a form created that I want to use on member profile pages.

    When the user fills in the form I want the email to go to the profiles email. Is there a way to use one form on all the pages and pick up the users email to send.

    I tried to add <?php echo $my_email ?> (which is in the code of the page and echo etc. displays the users email) in the to: field but does not seem to work

    any ideas?

    thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jared Atchison

    (@jaredatch)

    Hey fazzarrell,

    We don’t have that out of the box, however you could try create your own smart tag using a filter we have available. Below is an example to register a {my_email} Smart Tag. You would need to add the PHP logic to get the user email address though. Hope that helps!

    
    function wpf_email_smart_tag( $content, $tag ) {
    	
    	if ( 'my_email' == $tag ) {
    		$my_email = '[email protected]';
    		$content  = str_replace( '{my_email}', $my_email, $content );
    	}
    
    	return $content;
    }
    add_filter( 'wpforms_smart_tag_process', 'wpf_email_smart_tag', 10, 2 );
    
    Thread Starter fazzarrell

    (@fazzarrell)

    How do I create the smart tag? where do I put it? thanks

    Plugin Author Jared Atchison

    (@jaredatch)

    Hey fazzarrell,

    The smart tag code would go in your theme’s function.php file and would create a new smart tag {my_email}

    However the snippet I above would need further adjustment to work correctly, so it would likely only be helpful if you are familiar with PHP.

    Thread Starter fazzarrell

    (@fazzarrell)

    Hi

    thats cool thank you, I think I can work it out. Ill let you know the outcome when I test it later

    thanks you

    Thread Starter fazzarrell

    (@fazzarrell)

    Thourght i would be able to tie this up. But can’t.

    Im using and add on called staff members and on each member page I am adding the form.

    The ‘staff member’ page uses <?php echo $my_email ?> to display the users email.

    So I need the code ($my_email = ‘[email protected]’; ) to tie up with the email on each member page.

    Ill keep looking to try and work this out!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘One form to different emails’ is closed to new replies.