Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author xnau webdesign

    (@xnau)

    it looks to me like the [s] part doesn’t belong…also you should use anchors

    try this:

    /^[ABCEGHJKLMNPRSTVXY][0-9][ABCEGHJKLMNPRSTVWXYZ][0-9][ABCEGHJKLMNPRSTVWXYZ][0-9]$/

    Thread Starter huotg01

    (@huotg01)

    The provided regex doesn’t correct the problem, but it is probably something else because in the edit page (admin) the field is marked as mandatory (the “*”), and even if I delete the value, the system just do it. After seeing this, I tested another mandatory field (last_name) and again I was able to clear the field and commit it without any error message.

    All the records were uploaded from a csv file. Knowing that, I tried adding a new participant and was able to it without filling any field. The system just returned the new record with the record info.

    Your guidance will help me to track the problem down.

    Thanks,

    GAston

    Thread Starter huotg01

    (@huotg01)

    In phpmyadmin:
    column name: zip
    Values: a:10:{i:0;s:1:”1″;i:1;s:1:”2″;i:2;s:1:”3″;i:3;s:1:…
    Validation: no

    WordPress is “french”.

    Gaston

    Thread Starter huotg01

    (@huotg01)

    In phpmyadmin:
    column name: last_name
    Values:
    Validation: yes

    Plugin Author xnau webdesign

    (@xnau)

    OK, well, first it’s important to understand that when editing records as an admin in the backend, validation is not applied. This is to allow an admin the freedom to make any changes needed.

    If you want to test validation, you need to use a form on the frontend.

    Thread Starter huotg01

    (@huotg01)

    Well, this explains that…! Sorry about that.

    So now my question is : how can I make one person (the registrar) in a position to maintain (add and modify within the field test validation rules) the members database ? My understanding was that a participant can just maintain its own record (using his private id) and cannot create a new record ?

    I’m sure it is written in the documentation, but please just give me a link.

    Thanks,

    Gaston

    Plugin Author xnau webdesign

    (@xnau)

    There are two approaches to take with that. The easiest is to give the registrar limited privileges (such as an editor role) so they can add and maintain plugin records. Using custom roles can give you more control over which administrative pages such a user has access to.

    A more complex approach involves placing plugin forms on frontend pages that only logged-in users with a specific role can access. I don’t have much in the way of documentation for this, it’s fairly technical to implement.

    Using WP’s built-in backend access control is a lot easier, there are several plugins that set up custom roles and access limits. Participants Database has a “record editor” role which can be assigned to any defined user role, so if you define a custom role, you’d set that in the plugin settings as the record editor role.

    Thread Starter huotg01

    (@huotg01)

    I think my question was not clearly asked, or maybe I misunderstand something.

    The registrar already has the editor role. He is the person who will have to maintain the “participant database”.

    Our registrar used to maintain the members list on Excel, but he was doing so many mistakes that I decided to give him a tool with better control on field validation, and I choose Participants Database.

    Knowing that the validation rules are not applied if he is working with Participants Database in the backend (that’s what I understood), how can I manage the situation so that the registrar can add new participants, and also modify all existing records, but making sure that all the validation rules are followed ?

    Thanks,

    Gaston

    Plugin Author xnau webdesign

    (@xnau)

    OK, well it’s supposed to require validation of editor users. It doesn’t because of a bug.

    Put this fix in for that…on line 498 of classes/PDb_Base.class.php, you’ll find:

    return current_user_can(self::plugin_capability(self::plugin_setting($role), $context));

    replace that with this:

    return current_user_can(self::plugin_capability($role, $context));

    now, your editor will have to conform to the validation rules.

    Thanks for helping me find that bug.

    Thread Starter huotg01

    (@huotg01)

    xnau, it works perfectly.

    Thank you so much ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Regex for validating canadian postal code’ is closed to new replies.