Forum Replies Created

Viewing 15 replies - 1 through 15 (of 37 total)
  • Thread Starter dzamanakos

    (@dzamanakos)

    Thank you for your reply, it’s working now.

    best,

    Thread Starter dzamanakos

    (@dzamanakos)

    Hi, i did setup a test wordpress with CF7 and added a simplified code for 1 custom tag from my previous integration :

    https://wp.vlax.gr/contact/

    The code i’m using for the field “Custom phone number” is the one below:

    add_action( 'wpcf7_init', 'custom_add_form_tags' );
    function custom_add_form_tags() {
        wpcf7_add_form_tag( array( 'customphone', 'customphone*' ), 'custom_fields_form_tag_handler', array( 'name-attr' => true ) );
    }
    
    add_filter( "wpcf7_validate_customphone*", 'filter_wpcf7_validate_custom_fields', 10, 2 );
    
    // Validate the number to be in format +XXXXXXXXXXX
    function validatecustomerphonenumber($str) {
     if (preg_match('/^[+]{1}\d{12}$/', $str)) {
      return true;
     }
     return false;
    }
    
    
    function filter_wpcf7_validate_custom_fields( $result, $tag ) {
       $customnumfield = $tag->name;
       if ( !validatecustomerphonenumber($_POST[$customnumfield]) ) {
    	   $result->invalidate( $tag, "Phone number should be in the format of +302100000000" );
       }
       return $result;
    };
    
    function custom_fields_form_tag_handler( $tag ) {
        if ( empty( $tag->name ) ) { return ''; }
        if ( strpos($tag->type, '*') !== false ) {
            $tag->type = 'text*';
            $tag->basetype = 'text';
        }
        else {
          $tag->type = 'text';
          $tag->basetype = 'text';
        }
        $validation_error = wpcf7_get_validation_error( $tag->name );
        $class = wpcf7_form_controls_class( $tag->type );
        $class .= ' wpcf7-validates-as-custom-field';
        if ( $validation_error ) {
            $class .= ' wpcf7-not-valid';
        }
        $atts = array();
        $atts['class'] = $tag->get_class_option( $class );
        $atts['id'] = $tag->get_id_option();
        $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true );
        if ( $tag->has_option( 'readonly' ) ) { $atts['readonly'] = 'readonly'; }
        if ( $tag->is_required() ) { $atts['aria-required'] = 'true'; }
        $atts['aria-invalid'] = $validation_error ? 'true' : 'false';
        $value = (string) reset( $tag->values );
        if ( $tag->has_option( 'placeholder' ) || $tag->has_option( 'watermark' ) ) {
            $atts['placeholder'] = $value;
            $value = '';
        }
        $value = $tag->get_default_option( $value );
        $value = wpcf7_get_hangover( $tag->name, $value );
        $atts['value'] = $value;
        if ( wpcf7_support_html5() ) {
            $atts['type'] = $tag->basetype;
        } else {
            $atts['type'] = 'text';
        }
        $atts['name'] = $tag->name;
        $atts = wpcf7_format_atts( $atts );
        $html = sprintf(
            '<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
            sanitize_html_class( $tag->name ), $atts, $validation_error );
        return $html;
    }
    

    my form is :

    <div class="custom-class">
    	<h2>contact form</h2>
    	<div class="row">
    		<div class="col-md-6 col-xs-12">
    			<div class="input-group">
                                    <label for="your-name">Name (text field) *</label>
    				[text* your-name id:your-name ]
    			</div>
    		</div>
                    <div class="col-md-6 col-xs-12">
    			<div class="input-group">
                                    <label for="text-homeaddress">Address (text-field)</label>
    				[text text-homeaddress id:text-homeaddress]
    			</div>
    		</div>
                    <div class="col-md-6 col-xs-12">
    			<div class="input-group">
                                    <label for="text-customphone">Custom phone number (custom text-field) (+XXYYYYYYYYY)</label>
    				[customphone* text-customphone id:text-customphone]
    			</div>
    		</div>
    		<div class="col-md-12 col-xs-12 ">
    			<div class="input-group text-center">
    
    				<button type="submit" class="contact-submit vc_general vc_btn3 vc_btn3-size-md vc_btn3-style-flat vc_btn3-color-theme_style_1">SEND</button>
    			</div>
    		</div>
    	</div>
    </div>

    best,

    • This reply was modified 7 months, 3 weeks ago by dzamanakos.
    dzamanakos

    (@dzamanakos)

    Hi, i have the same question,
    best

    Thread Starter dzamanakos

    (@dzamanakos)

    Thank you, if anyone see this post the solution is with a filter :

    add_filter( ‘ep_config_mapping’, function( $mappings ) {
    $mappings[‘settings’][‘analysis’][‘analyzer’][‘default’][‘filter’][] = ‘asciifolding’;
    return $mappings;
    } )

    Thread Starter dzamanakos

    (@dzamanakos)

    Hi, thank you for your reply.
    It seems that it was something browser related, as after clearing cookies/cache etc and re-opening the browsers, the ajax started working again.

    best,

    Thread Starter dzamanakos

    (@dzamanakos)

    Παρατηρ?σαμε μετα απο δοκιμ?, ?τι το single quote δημιουργε? το πρ?βλημα.

    Thread Starter dzamanakos

    (@dzamanakos)

    Hi, after sometime all products indexed via the cron hook you provide, but later today it started over.
    I have 443672 products, run the indexing via the cron all day and the next day i see that all products were indexed.
    An hour ago i see in settings that 53520 were indexed and it keeps going.

    Is there a way to not start over, as the product count is too large to wait to re-index?

    best,

    Thread Starter dzamanakos

    (@dzamanakos)

    For now i added the cron indexing option, via the hook you provide.
    I’m waiting to finish, as it started over.

    After one indexing is done (via cron), every other cron should run only for the new products?

    best,

    Hi, you may do something like this :
    if you want to print a column of the field [your-mobile]

    function flamingo_columns( $columns ) {
        $columns['mobilenumber']="Mobile Number";
        return $columns;
    }
    add_filter( 'manage_flamingo_inbound_posts_columns', 'flamingo_columns' );
    
    add_action('manage_flamingo_inbound_posts_custom_column', 'print_flamingo_mobile', 10, 2);
    function print_flamingo_mobile($column_name,$post_id) {
      if ($column_name=='mobilenumber') {
        echo get_post_meta( $post_id, '_field_your-mobile', true );
      }
    }
    Thread Starter dzamanakos

    (@dzamanakos)

    Hi, a follow up. The problem was solved.
    The problem was not caused by the js code but from a code running with the add_action( ‘wpcf7_mail_sent’, ‘handle_form_submission’ ); hook.

    In my function i’m posting every from with php curl to another host.
    That post caused the “success message” not showing, even though the curl was running under 1 sec.
    I changed the curl with a async library in order to stop the form to wait for the response and all worked.

    Thread Starter dzamanakos

    (@dzamanakos)

    Hi, i’m using various plugins and a theme from themeforest, but there are other forms in the website where the wpcf7submit is working. I have 15 forms, some are working, some not, with the same plugins running in each form (by not working i mean that i cant catch the wpcf7submit event, the emails are sent from all forms).
    You think it’s a plugin conflict?
    Are you suggesting to start disabling the plugins?
    I would do that if all the forms were not working, but i can make a test site and start disabling.

    best regards,

    Thread Starter dzamanakos

    (@dzamanakos)

    Hi, thank you for your fast reply.
    One of the forms is on : https://www.eyath.gr/registration-of-metering-readings/?lang=en
    The javascript i’m using, for the form events, is in one of the site’s js:

    if (jQuery(“.wpcf7”).length > 0) {
    jQuery(‘.wpcf7-form button’).click(function() {
    jQuery(‘.loading’).show();
    jQuery(‘.wpcf7-form button’).hide();
    console.log(‘hide’);
    })

    document.addEventListener( ‘wpcf7submit’, function( event ) {
    console.log(‘show’);
    jQuery(‘.loading’).hide();
    jQuery(‘.wpcf7-form button’).show();
    console.log(‘found2’);
    }, false );

    }

    best regards,

    Thread Starter dzamanakos

    (@dzamanakos)

    Hi, i thought that was strange too, as when i started disabling plugins in order to find out what caused the problem, i’ve disabled yours last, as i didnt think that it would cause the problem.
    The other plugin that you suggest is 5 years old without updates, i’ll try if its still compatible.
    If you wish i can give you access to a temp installation or send you a copy of the theme in order to check it (dont think that the developer will have a problem to install it in a testing env to debug).
    best regards,

    Thread Starter dzamanakos

    (@dzamanakos)

    other, like images, js, css

    Thread Starter dzamanakos

    (@dzamanakos)

    Hi, i’m also the hosting provider and my question stands, that for websites in the same webserver (same apache/hosting settings), I get
    cache-control :no-cache to some websites
    cache-control max-age=10368000 to some others

    All have the same wp fastest cache settings and htaccess records.

    Is there any possibility that some plugins cause the no-cache to headers?
    best regards,

Viewing 15 replies - 1 through 15 (of 37 total)