Quform Custom Code to various forms

Home Forums Quform WordPress Quform Custom Code to various forms

This topic is: resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #21481
    burgmestre
    Participant

    Hi,

    I’ve created 4 different forms on my website (one for each language). In these forms, I need to use an e-mail validator, and change the path of the uploaded files.

    I’ve followed your guides using Quform Custom Code. But my problem is that is working only with one form. When I want to configure for the others, it stops working.

    This is an example: when I configure the Custom Code with this parameters, it is working:
    ?php

    /*
    * Plugin Name: Quform Custom Code
    * Description: Custom code for Quform.
    * Version: 1.0
    */

    // Paste in your custom code below
    function my_override_upload_path($path, $element)
    {
    $name = $element->getForm()->getValue(‘iphorm_12_35’);
    $name = sanitize_file_name($name);

    return “espectacle/$name/”;
    }
    add_filter(‘iphorm_upload_path_12’, ‘my_override_upload_path’, 10, 2);

    —————————

    But if I try to put the information of the other forms, it isn’t working:

    ?php

    /*
    * Plugin Name: Quform Custom Code
    * Description: Custom code for Quform.
    * Version: 1.0
    */

    // Paste in your custom code below
    function my_override_upload_path($path, $element)
    {
    $name = $element->getForm()->getValue(‘iphorm_12_35’);
    $name = sanitize_file_name($name);

    return “espectacle/$name/”;
    }
    add_filter(‘iphorm_upload_path_12’, ‘my_override_upload_path’, 10, 2);
    function my_override_upload_path($path, $element)
    {
    $name = $element->getForm()->getValue(‘iphorm_13_35’);
    $name = sanitize_file_name($name);

    return “espectacle/$name/”;
    }
    add_filter(‘iphorm_upload_path_13’, ‘my_override_upload_path’, 10, 2);
    function my_override_upload_path($path, $element)
    {
    $name = $element->getForm()->getValue(‘iphorm_16_35’);
    $name = sanitize_file_name($name);

    return “espectacle/$name/”;
    }
    add_filter(‘iphorm_upload_path_16’, ‘my_override_upload_path’, 10, 2);
    function my_override_upload_path($path, $element)
    {
    $name = $element->getForm()->getValue(‘iphorm_17_35’);
    $name = sanitize_file_name($name);

    return “espectacle/$name/”;
    }
    add_filter(‘iphorm_upload_path_17’, ‘my_override_upload_path’, 10, 2);

    ————

    What is my mistake?

    Thanks,

    Arnau

    #21501
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    • This reply was modified 6 years, 8 months ago by Ally.
    #21518
    burgmestre
    Participant

    Ok, now it’s fixed and solved. Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy