Forum Replies Created

Viewing 15 replies - 46 through 60 (of 61 total)
  • Thread Starter SrGato29

    (@jonadeis)

    I have multiple emails, like

    value1|somebody@gmail.com
    value2|somebody@gmail.com
    value3|test@gmail.com

    I know that I have to use this:

    value1|somebody+email1@gmail.com
    value2|somebody+email2@gmail.com
    value3|test@gmail.com

    so that way I’will receive the correct value, but I don’t want to do that because in my email is like:

    to: somebody+email1@gmail.com instead of somebody@gmail.com
    the same thing happens in my contact db table

    There is a way to fix that , so that way I will use this somebody@gmail.com instead of somebody+email1@gmail.com

    Thread Starter SrGato29

    (@jonadeis)

    Is there a way to not use “+” when there are multiple emails?

    Thread Starter SrGato29

    (@jonadeis)

    Mmmm Im using the lastest code, but Im repeating some emails, I know that I have to use emaiexample+test1@test.com the symbol “+” to differenciate the emails so that way I will not the receive the wrong values, but I saw this code in your page

    Array
    (
        [0] => Array
            (
                [type] => select
                [basetype] => select
                [name] => location
                [options] => Array
                    (
                    )
    
                [raw_values] => Array
                    (
                        [0] => location1|email1@nowhere.com
                        [1] => location2|email2@nowhere.com
                        [2] => location3|email3@nowhere.com
                    )
    
                [values] => Array
                    (
                        [0] => location1
                        [1] => location2
                        [2] => location3
                    )
    
                [pipes] => WPCF7_Pipes Object
                    (
                        [pipes:WPCF7_Pipes:private] => Array
                            (
                                [0] => WPCF7_Pipe Object
                                    (
                                        [before] => location1
                                        [after] => email1@nowhere.com
                                    )
    
                                [1] => WPCF7_Pipe Object
                                    (
                                        [before] => location2
                                        [after] => email2@nowhere.com
                                    )
    
                                [2] => WPCF7_Pipe Object
                                    (
                                        [before] => location3
                                        [after] => email3@nowhere.com
                                    )
    
                            )
    
                    )
    
                [labels] => Array
                    (
                        [0] => location1
                        [1] => location2
                        [2] => location3
                    )
    
                [attr] =>
                [content] =>
            )
    
        [1] => Array
            (
                [type] => submit
                [basetype] => submit
                [name] =>
                [options] => Array
                    (
                    )
    
                [raw_values] => Array
                    (
                        [0] => Send
                    )
    
                [values] => Array
                    (
                        [0] => Send
                    )
    
                [pipes] => WPCF7_Pipes Object
                    (
                        [pipes:WPCF7_Pipes:private] => Array
                            (
                                [0] => WPCF7_Pipe Object
                                    (
                                        [before] => Send
                                        [after] => Send
                                    )
    
                            )
    
                    )
    
                [labels] => Array
                    (
                        [0] => Send
                    )
    
                [attr] =>
                [content] =>
            )
    
    )

    I changed some values to work with my form but it didnt work, I dont want to see the value after the + symbol

    Thread Starter SrGato29

    (@jonadeis)

    mmm ok I’ll try it 😀

    Thread Starter SrGato29

    (@jonadeis)

    So in the code above , I have to change “radio” for “select” ? only that?

    Thread Starter SrGato29

    (@jonadeis)

    oh thanks a lot!!! that works 😀

    Thread Starter SrGato29

    (@jonadeis)

    Also Im using a radio button….

    Thread Starter SrGato29

    (@jonadeis)

    also I comment the lines that you said and It did not work, my forms are :

    [contact-form-7 id=”56773″ title=”Trámites ante entidades públicas y privadas”]
    [contact-form-7 id=”56758″ title=”Trámites ante la oficina AFSDP”]

    Thread Starter SrGato29

    (@jonadeis)

    Mmm it still doesnt work…

    the first function is

    function form_with_pipes_handler($formName, $fieldName, $newFieldName, &$formData)
    {
        if ($formData &&
                $formName == $formData->title &&
                property_exists($formData, 'WPCF7_ContactForm') &&
                method_exists($formData->WPCF7_ContactForm, 'form_scan_shortcode')) {
    
            $scanned_form_tags = $formData->WPCF7_ContactForm->form_scan_shortcode();
            $emailSelected = $formData->posted_data[$fieldName];
            $valueSelected = null;
            foreach ($scanned_form_tags as $tag) {
                if ($tag['name'] == $fieldName) {
                    foreach ($tag['raw_values'] as $rawValue) {
                        // value|email
                        $valuesArray = explode('|', $rawValue);
                        if (count($valuesArray) == 2 && $valuesArray[1] == $emailSelected) {
                            $valueSelected = $valuesArray[0];
                            break;
                        }
                    }
                }
                if ($valueSelected != null) {
                    break;
                }
            }
            if ($valueSelected != null) {
                $formData->posted_data[$fieldName] = $valueSelected;
                $formData->posted_data[$newFieldName] = $emailSelected;
            }
        }
        return $formData;
    }

    then

    function location_form_handler($formData)
    {
        $formName = 'Trámites ante la oficina AFSDP'; // change this to your form's name
        $fieldName = 'your-recipient'; // change this to your field's name
        $newFieldName = $fieldName . '_email';
        return form_with_pipes_handler($formName, $fieldName, $newFieldName, $formData);
    }
     add_filter('cfdb_form_data', 'location_form_handler');

    then

    function location_form_handler_form2($formData)
    {
        $formName = 'Trámites ante entidades públicas y privadas'; // change this to your form's name
        $fieldName = 'tramiteprivadapublico'; // change this to your field's name
        $newFieldName = $fieldName . '_email';
        return form_with_pipes_handler($formName, $fieldName, $newFieldName, $formData);
    }
     add_filter('cfdb_form_data', 'location_form_handler_form2');

    They has a check in “Activated and Execute also on dashboard pages”,

    I have contact form version 4.4 and contact form db 2.10.1, What else can I do?

    Thread Starter SrGato29

    (@jonadeis)

    function form_with_pipes_handler($formName, $fieldName, $newFieldName, &$formData)
    {
        if ($formData &&
                $formName == $formData->title &&
                property_exists($formData, 'WPCF7_ContactForm') &&
                method_exists($formData->WPCF7_ContactForm, 'form_scan_shortcode')) {
    
            $scanned_form_tags = $formData->WPCF7_ContactForm->form_scan_shortcode();
            $emailSelected = $formData->posted_data[$fieldName];
            $valueSelected = null;
            foreach ($scanned_form_tags as $tag) {
                if ($tag['name'] == $fieldName) {
                    foreach ($tag['raw_values'] as $rawValue) {
                        // value|email
                        $valuesArray = explode('|', $rawValue);
                        if (count($valuesArray) == 2 && $valuesArray[1] == $emailSelected) {
                            $valueSelected = $valuesArray[0];
                            break;
                        }
                    }
                }
                if ($valueSelected != null) {
                    break;
                }
            }
            if ($valueSelected != null) {
                $formData->posted_data[$fieldName] = $valueSelected;
                $formData->posted_data[$newFieldName] = $emailSelected;
            }
        }
        return $formData;
    }
    
    add_filter('cfdb_form_data', 'location_form_handler');
    function location_form_handler($formData)
    {
        $formName = 'Trámites ante la oficina AFSDP'; // change this to your form's name
        $fieldName = 'your-recipient'; // change this to your field's name
        $newFieldName = $fieldName . '_email';
        return form_with_pipes_handler($formName, $fieldName, $newFieldName, $formData);
    }

    This is my code, but it doesnt work, mm I have 2 forms on the same page, and in both of them I’m using the pipes, but with only one I used the functions and it doesnt work :c

    Thread Starter SrGato29

    (@jonadeis)

    MMM I use the code with the plugin https://wordpress.org/plugins/add-actions-and-filters/ but it doesnt work my cod is function location_form_handler($formData)
    {
    $formName = ‘Trámites ante la oficina AFSDP’; // change this to your form’s name
    $fieldName = ‘your-recipient’; // change this to your field’s name
    $newFieldName = $fieldName . ‘_email’;
    return form_with_pipes_handler($formName, $fieldName, $newFieldName, $formData);
    }

    function form_with_pipes_handler($formName, $fieldName, $newFieldName, &$formData)
    {
    if ($formData &&
    $formName == $formData->title &&
    property_exists($formData, ‘WPCF7_ContactForm’) &&
    method_exists($formData->WPCF7_ContactForm, ‘form_scan_shortcode’)) {

    $scanned_form_tags = $formData->WPCF7_ContactForm->form_scan_shortcode();
    $emailSelected = $formData->posted_data[$fieldName];
    $valueSelected = null;
    foreach ($scanned_form_tags as $tag) {
    if ($tag[‘name’] == $fieldName) {
    foreach ($tag[‘raw_values’] as $rawValue) {
    // value|email
    $valuesArray = explode(‘|’, $rawValue);
    if (count($valuesArray) == 2 && $valuesArray[1] == $emailSelected) {
    $valueSelected = $valuesArray[0];
    break;
    }
    }
    }
    if ($valueSelected != null) {
    break;
    }
    }
    if ($valueSelected != null) {
    $formData->posted_data[$fieldName] = $valueSelected;
    $formData->posted_data[$newFieldName] = $emailSelected;
    }
    }
    return $formData;
    }

    add_filter(‘cfdb_form_data’, ‘location_form_handler’);

    it’s activated and it has a check in “Execute also on Dashboard Pages” but I can see the changes

    Thread Starter SrGato29

    (@jonadeis)

    Oh thanks a lot, it works !! 😀

    Thread Starter SrGato29

    (@jonadeis)

    Oh thanks a lot,
    function location_form_handler($formData)
    {
    $formName = ‘Pipes’; // change this to your form’s name
    $fieldName = ‘location’; // change this to your field’s name
    $newFieldName = $fieldName . ‘_email’;
    return form_with_pipes_handler($formName, $fieldName, $newFieldName, $formData);
    }
    What can I do if I have more than one form with pipes? I have to create more functions?

    Hi there,

    Im receiving the same error,and I have the same plugins, help me please.

    Thanks in advance

    Thread Starter SrGato29

    (@jonadeis)

    Hi there,
    I added a template for the posts, but when I add a template for my custom taxonomy, It leads me to a 404 error page, I only can see the terms, for example:

    http://www.page.com/customtaxonomy = Error 404
    http://www.page.com/customtaxonomy/term1 = Display content (with its template taxonomy-customtaxonomy.php)

    So I hope you could help me please.

    Thanks in advance

Viewing 15 replies - 46 through 60 (of 61 total)