Forum Replies Created

Viewing 9 replies - 16 through 24 (of 24 total)
  • Thread Starter cognoquest

    (@cognoquest)

    Creating my own language .mo files may not be in the long run the best approach to all this? So I tried the following code:
    $error_messages[] = $error == 'nonmatching' ? sprintf( esc_html( $this->error_messages[$error] ), $field_atts->title, Participants_Db::column_title( $field_atts->validation ) ) : sprintf( esc_html( $this->error_messages[$error] ), $field_atts->title );

    The esc_html() function seem to have resolved my problem. Now you might want to consider resolving this at the source of the problem with: https://codex.www.ads-software.com/Function_Reference/esc_html_2

    If you wish me to try the above solution where the messages are being retrieve let me know?

    Thread Starter cognoquest

    (@cognoquest)

    I think some strange code value that we can not see got introduced in the messages? Unless you have other idea, I think I need to find those messages in the DB?

    Oops I stand corrected it appears to come from the language binary bundle. I am going to attempt to override those messages?

    Thread Starter cognoquest

    (@cognoquest)

    I too am baffled by this problem and after a second look at the code, I agree the code is not the issue here.

    I kept an eye on the Apache Logger and that was not showing any problems. I am new to the PHP/WP world so good on you to remind me about that logging facility.

    I knew something weird was going on here, my code and logger set to display on the web page:

    $error_messages[] = $error == 'nonmatching' ? sprintf( $this->error_messages[$error], $field_atts->title, Participants_Db::column_title( $field_atts->validation ) ) : sprintf( $this->error_messages[$error], $field_atts->title );
    
    echo '<!-- hello world 2 ';
    var_dump( $error );
    var_dump( $this->error_messages[$error] );
    var_dump( $field_atts->title );
    var_dump( $error_messages );
    echo '-->';

    The result:

    Warning: sprintf(): Too few arguments in /var/clearos/wordpress/webroot/live/wp-content/plugins/participants-database-beta/classes/PDb_FormValidation.class.php on line 285
    <!– hello world 2
    string(5) “empty”
    string(65) “The ‘%s’ field is required.”
    string(30) “First Name”
    array(1) {
    [0]=>
    bool(false)
    }
    –>
    Warning: sprintf(): Too few arguments in /var/clearos/wordpress/webroot/live/wp-content/plugins/participants-database-beta/classes/PDb_FormValidation.class.php on line 285
    <!– hello world 2
    string(5) “empty”
    string(65) “The ‘%s’ field is required.”
    string(22) “City”
    array(2) {
    [0]=>
    bool(false)
    [1]=>
    bool(false)
    }
    –>
    Warning: sprintf(): Too few arguments in /var/clearos/wordpress/webroot/live/wp-content/plugins/participants-database-beta/classes/PDb_FormValidation.class.php on line 285
    <!– hello world 2
    string(5) “empty”
    string(65) “The ‘%s’ field is required.”
    string(43) “Date of Birth”
    array(3) {
    [0]=>
    bool(false)
    [1]=>
    bool(false)
    [2]=>
    bool(false)
    }
    –>
    Warning: sprintf(): Too few arguments in /var/clearos/wordpress/webroot/live/wp-content/plugins/participants-database-beta/classes/PDb_FormValidation.class.php on line 285
    <!– hello world 2
    string(7) “invalid”
    string(85) “The ‘%s’ field appears to be incorrect.”
    string(38) “Verification”
    array(4) {
    [0]=>
    bool(false)
    [1]=>
    bool(false)
    [2]=>
    bool(false)
    [3]=>
    bool(false)
    }
    –>

    Hmm interesting problem … it seems like sprintf believes that there is more that one specifier in the variable value for: $this->error_messages[$error]?

    I temporarily reinitialized the variables at the beginning of the function to see if that is indeed the problem by adding:

    $this->error_messages['empty'] = "The '%s' field is required";
    $this->error_messages['invalid'] = "The '%s' field appears to be incorrect.";

    And voila the result:

    <!– hello world 2
    string(5) “empty”
    string(26) “The ‘%s’ field is required”
    string(30) “First Name”
    array(1) {
    [0]=>
    string(54) “The ‘First Name’ field is required”
    }
    –><!– hello world 2
    string(5) “empty”
    string(26) “The ‘%s’ field is required”
    string(22) “City”
    array(2) {
    [0]=>
    string(54) “The ‘First Name’ field is required”
    [1]=>
    string(46) “The ‘City’ field is required”
    }
    –><!– hello world 2
    string(5) “empty”
    string(26) “The ‘%s’ field is required”
    string(43) “Date of Birth”
    array(3) {
    [0]=>
    string(54) “The ‘First Name’ field is required”
    [1]=>
    string(46) “The ‘City’ field is required”
    [2]=>
    string(67) “The ‘Date of Birth’ field is required”
    }
    –><!– hello world 2
    string(7) “invalid”
    string(39) “The ‘%s’ field appears to be incorrect.”
    string(38) “Verification”
    array(4) {
    [0]=>
    string(54) “The ‘First Name’ field is required”
    [1]=>
    string(46) “The ‘City’ field is required”
    [2]=>
    string(67) “The ‘Date of Birth’ field is required”
    [3]=>
    string(75) “The ‘Verification’ field appears to be incorrect.”
    }
    –>

    I think some strange code value that we can not see got introduced in the messages? Unless you have other idea, I think I need to find those messages in the DB?

    Thread Starter cognoquest

    (@cognoquest)

    Hello, wow you are fast at responding!!, thks for the help

    The <?php $this->print_errors(); ?> works because the messages appears if I reverse the operator.

    Here is what I get with the == operator:

    <style type=”text/css”>[class*=”pdb-“] [name=”first_name”],
    [class*=”pdb-“] [name=”city”],
    [class*=”pdb-“] [name=”yp_reg_date_of_birth”],
    [class*=”pdb-“] [name=”yp_reg_captcha_verif[]”]{ border: 1px solid red; }</style><div class=”pdb-error”><p></p><p></p><p></p><p></p></div>

    If I dump, Participants_Db::$validation_errors->get_error_fields() & $this->error_messages at the start of the function this is what I get:

    <!-- hello world 1 array(4) {
      ["first_name"]=>
      string(5) "empty"
      ["city"]=>
      string(5) "empty"
      ["yp_reg_date_of_birth"]=>
      string(5) "empty"
      ["yp_reg_captcha_verif"]=>
      string(7) "captcha"
    }
    array(15) {
      [0]=>
      string(7) "invalid"
      [1]=>
      string(5) "empty"
      [2]=>
      string(11) "nonmatching"
      [3]=>
      string(9) "duplicate"
      [4]=>
      string(7) "captcha"
      [5]=>
      string(10) "identifier"
      ["invalid"]=>
      string(85) "The '%s' field appears to be incorrect."
      ["empty"]=>
      string(65) "The '%s' field is required."
      ["nonmatching"]=>
      string(100) "The '%s' field must match the '%s' field."
      ["duplicate"]=>
      string(138) "A record with that %s already exists. Please choose another."
      ["captcha"]=>
      string(91) "Please try the '%s' question again."
      ["identifier"]=>
      string(115) "A record matching that %s cannot be found."
      ["yp_session_req"]=>
      string(46) "At least one Sailing Session must be selected."
      ["participant_age"]=>
      string(73) "Participant age must be between 9 and 20 to be eligible for the programs."
      ["reg_accepted"]=>
      string(37) "A record with that %s already exists."
    }
    -->

    Let me know if you need anything more?

    Thread Starter cognoquest

    (@cognoquest)

    Oh ya, I forgot about an extra modification that I did, all the Multiselect form elements where configured bold, following the same above pattern, the bootstrap css is showing in my theme:

    This is what the bootstrap.min.css is configured with for label

    label {
      ...
      font-weight: 700;
    }

    This is what the participants-database.css is configured with for the following for labels:

    .selectother label, .multicheckbox label, .file-delete label, .csv-export label, .radio-group label, .radio-subgroup label, .othercontrol {
      margin: 0px 12px 0px 0px;
      width: auto;
      white-space: nowrap;
      display: inline-block;
    }

    I added the following to my child theme:

    .selectother label, .multicheckbox label, .file-delete label, .csv-export label, .radio-group label, .radio-subgroup label, .othercontrol {
      font-weight: normal;
    }

    Thread Starter cognoquest

    (@cognoquest)

    Interesting thks

    Thread Starter cognoquest

    (@cognoquest)

    I completely agree with you, it is not possible to have a plugin that would meet the demands of every theme out there.
    Again you are once more correct about me running a child theme for the Colorlib: Sparkling (style.css). I believe the sparkling theme is a minimalist theme, it does little for formatting, hence I had to add some css code such as:

    ...
    #page .dropdown th, td {
      padding: 5px;      /* Provides some space inside within the boxes */
      border: 1px solid #D3D3D3; /* Grey */
    }
    .dropdown:hover td { /* Provides highlight table rows on mouse over */
      background-color: #f5f5f5;
    }
    ...

    Why I brought up the subject is the inconsistency of the two classes that is leaving me perplex? I used as suggested the boostrap template, which bypasses my css modifications and again I see the same inconsistency with the classes now called class=”checkbox control-group ” and <div class=”radio control-group “>
    These classes for some kind of reason are not behaving consistently such as the rest of the classes? if you wish to have a look I have updated the Example I took out the verification (CAPCHA) field for clarity and the two bottoms fields if you look carefully are not following the above field’s pattern?

    B.T.W. I started working on WordPress and PHP about a month ago and I am so glad I found your Plugin for my initiation. I am learning so much from your top notch templates and code and I appreciate your help.

    Thread Starter cognoquest

    (@cognoquest)

    Thank You

    Thread Starter cognoquest

    (@cognoquest)

    Sorry correction:

    I have had to use ‘None::00’ instead of ‘None::0’

Viewing 9 replies - 16 through 24 (of 24 total)