• Resolved Patrick

    (@uentooser)


    Howdy Support Team,

    I’ve got an problem with one of your contact forms in my WordPress Environment.

    So I have a simple contactform with dropdown items. Behind the dropdown items there are some email addresses. For example

    Usually in my receipient I choose {select-1} for the email address, all fine – that works pretty well. But in the subject from the email I want to put the Label from the dropdown menu item in there.

    So in CF7 for example it works with “[_raw_select-1]” how it works in your plugin?

    Thanks for your assistance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @uentooser

    I hope you are doing well today.

    By default, you can send only labels or values and this is controlled by: Default Stored Value settings:
    https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#multiple-option-value

    I pinged our SLS Team to check if there is a possibility to split this by some snippet. We will post an update here as soon as more information is available.

    Kind Regards,
    Kris

    Thread Starter Patrick

    (@uentooser)

    Thanks @wpmudevsupport13 this would be perfect bc otherwise I can’t use your plugin 🙁

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @uentooser

    Please us this snippet as a mu-plugin:

    add_filter( 'forminator_custom_form_mail_admin_message', 'wpmudev_replace_select_with_val', 10, 5 );
    function wpmudev_replace_select_with_val( $message, $custom_form, $data, $entry, $cls_mail ) {
        if ( 1609 != $custom_form->id ) { // Please change the form ID.
            return $message;
        }
    
        if ( false !== strpos( $message, '{wpmudev-select-1}' ) ) {
            // Please change select-1 to your select field's ID.
            $message = str_replace( '{wpmudev-select-1}', $data['select-1'], $message ); 
        }
    
        return $message;
    }

    In the subject you can use {select-1} and by default, the label will show there. But in the email body you need to use {wpmudev-select-1} macro and the rest of the snippet will manage.

    To learn more about how to install MU-Plugin to a site, please, check this out: https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Kind Regards,
    Kris

    Thread Starter Patrick

    (@uentooser)

    Thanks for your help @wpmudevsupport13 – how can I use this script for multiple selectors like select-1 select-2 and so on?

    Thanks.

    When will this feature maintained to the Forminator plugin?

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @uentooser

    You’ll need to multiply this block of code:

    if ( false !== strpos( $message, '{wpmudev-select-1}' ) ) {
            // Please change select-1 to your select field's ID.
            $message = str_replace( '{wpmudev-select-1}', $data['select-1'], $message ); 
        }

    Just repeat it – one after another, directly – as many times as you have those select fields and in each one adjust both “wpmudev-select-1” and “select-1” accordingly. For exmaple, to handle select-1 and select-2 it would be like this

    if ( false !== strpos( $message, '{wpmudev-select-1}' ) ) {
            // Please change select-1 to your select field's ID.
            $message = str_replace( '{wpmudev-select-1}', $data['select-1'], $message ); 
        }
    
    if ( false !== strpos( $message, '{wpmudev-select-2}' ) ) {
            // Please change select-2 to your select field's ID.
            $message = str_replace( '{wpmudev-select-2}', $data['select-2'], $message ); 
        }

    Then, accordingly, you just use {wpmudev-select-1}, {wpmudev-select-2} and so on.

    When will this feature maintained to the Forminator plugin?

    At this point there’s yet no plans for this. It may be changed in future but I’m not able to say if for sure and if so – when, I’m afraid. But I have passed this suggestion to our Formiantor Team to take under consideration.

    Kind regards,
    Adam

    Hi @uentooser,

    We haven’t heard from you in a while, I’ll go and mark this thread as resolved. Note that you can still reply on this topic.

    If you have any additional questions or require further help, please let us know!

    Best regards,
    Laura

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Using Label Name instead of Label Value’ is closed to new replies.