Plugin does not work since the last update

Plugin Author
Phil

(@philsbury)

Hi @rollivier,

Do you get any errors? Or is there a link I can see.

Also, when you say last update, do you mean 3.0.3 -> 3.0.4, or 2.x.x to 3.x.x?

Thanks
Phil

Hello,

I deactivated the plugin temporarily to avoid blocking users.

I just reactivated it so you can check: https://pech-latt.com/

The problem is on all browsers, even mobile.
I have no error on Firefox, but on Chrome I get the following error when I press enter:

– An invalid form control with name=’age_gate[d]’ is not focusable

– An invalid form control with name=’age_gate[m]’ is not focusable

Concerning the version, I don’t know, the problem appeared on September 16th

Plugin Author
Phil

(@philsbury)

Hi @rollivier,

Ok great, had a look.

Have we (or you) done something in the past to allow users to just do Year, then month then day as I see this:

<script type="text/javascript">(function($){
$(window).on('agegateshown', function(){ 
    var d = new Date(),
        y = d.getFullYear(),
        a = atob(atob(document.querySelector('[name="age_gate[age]"]').value));

    $('#age-gate-y').on('keyup', function(event){
      if (this.value.length === 4) {
        if ((y - this.value) === a) {
          $('.age-gate-form-section, .age-gate-submit').show();
          $('.age-gate-form-section:first input').focus();
        } else {
          $('#age-gate-m, #age-gate-d').val('01');
          $('.age-gate-form').submit();
        }
      }
    });
   }); 
})(jQuery);

</script>

and this:


.age-gate-form-section:not(:last-of-type) {
    display: none;
}

and finally:


.age-gate-submit {
    display: none !important;
}

So it looks like there’s some stepped inputs in there.

You can remove all of that, then just enable “Stepped input” under the Restriction settings. There are some browsers this doesn’t work in, but anything up-to-date it will. For those that don’t it defaults to “normal” inputs

The good news is if I remove the styles the form works ok, so that’s a plus

Thanks
Phil

Hello,

I removed the code and changed the CSS and it works.

I activated Stepped input in the settings and it only shows me the year on computer! Thank you!

But on mobile I have the days and months fields. How can I make sure that I only have the year as a field to fill in?

Thanks
Romain

Plugin Author
Phil

(@philsbury)

Hi @rollivier,

As I say it depends on the browser version. For me on iOS 16, it’s all good, I just get the year.

Essentially it requires the browser to support a certain javascript method and if it doesn’t, it defaults to just inputs – hence it being a beta feature right now.

However, some changes that were made to the submission on safari might allow me to make it work for other browsers too, I’d have to have a look into it. I’ve created myself a ticket to have do so.

Thanks
Phil

Hello,

Ok, thanks for the clarification, I thought it was on the really old browsers, but in fact, it’s a very recent feature.

Just a question, but I was wondering, why not rather propose to the users of the plugin to choose in the parameters the date format they want (in addition to YYYY MM DD …), but propose an additional option, something like this:

– Full date: (DD MM YYYYY)
– Month and year only (MM YYYY)
– Year only (YYYY)

And manage this display on your side with PHP and javascript, which would offer more flexibility and stability.

Anyway, thanks for your help, I’ll do it like that for the moment.

Thanks
Romain

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Your Advertisement Here