• Resolved wpfan1000

    (@wpfan1000)


    In

    http://www.fastsecurecontactform.com/shortcode-options

    I see that you have the $email_to paramater.

    For me I need a form that will use the current logged in user email address for the “from” email address and the post author email address for the “to” email address.

    In other words I would like the user that is viewing a post to be able to contact the author of that post, where both email addresses are programatically set.

    Is there also a $email_from parameter?

    Sorry but I have not been able to find it by searching.

    Thanks for such a great plugin.

    https://wordpress.org/plugins/si-contact-form/

Viewing 4 replies - 1 through 4 (of 4 total)
  • There are hooks for modifying the from name and from email

    // hook for modifying the from_name and from_email
    self::$email_fields['from_name'] = apply_filters('si_contact_from_name', self::$email_fields['from_name'], self::$form_id_num);
    self::$email_fields['from_email'] = apply_filters('si_contact_from_email', self::$email_fields['from_email'], self::$form_id_num);

    Here is an example of how a hook can be used:

    filter hook for modifying the email message from_name

    Add the function code to your theme’s functions.php file or to a custom plugin.
    be aware that if you change your theme the code has to be added to the functions.php of the new theme.

    Be sure to set the setting inside the function to control which forms you want this function applied.
    example run this code for all forms:
    $all_forms = true;

    example run this code for form 1 only:
    $all_forms = false;
    $forms = array(‘1’);

    example run this code for form 1, 2, and 5 only:
    $all_forms = false;

    $forms = array(‘1′,’2′,’5’);

    function my_action_from_name($from_name, $form_id_num) {
    
    ##################################
     // control which forms you want this on
     $all_forms = false; // set to true for process on all forms, or false to use settings below
     $forms = array('1','2');  // one or more individual forms
     ##################################
     if ( !in_array($form_id_num, $forms) && $all_forms != true)
     return $from_name;
    
      // change the email from_name
      $from_name = 'the name you want';
    
       return $from_name;
    
    }
    // filter hook to change the email from_name
    add_filter('si_contact_from_name', 'my_action_from_name', 1, 2);
    Thread Starter wpfan1000

    (@wpfan1000)

    Thanks Mike for getting back to me and explaining.

    I do use your plugin for quite a few websites but in this case there is another plugin that has this feature so I will go with that plugin for this case.

    @wpfan1000 could you share the plugin that has the feature you are after. This is so if anyone comes across a similar situation as you they could use that plugin.

    Can you also mark this support thread as resolved.

    Thank you

    Thread Starter wpfan1000

    (@wpfan1000)

    Hi mbrsolution,

    Always happy to share what I have found – here you go:

    The plugin is Contact form 7 and here are the pertinent details:

    Create a new form.

    In the Form tab:

    <p>Your Email (required)
    [email* your-email default:user_email readonly ]</p>

    This sets the From email to the current user – readonly is optional – I do not want users to change their email so I set it to read only.

    Mail tab

    To: [_post_author_email]
    This sets the To email to the post author

    That’s it – hope it helps.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Is there also a $email_from parameter?’ is closed to new replies.