WordPress.org

Ready to get started?Download WordPress

Forums

BP Xtra Signup
Plugin translation breaks bpxs_get_month_number function (2 posts)

  1. teonsight
    Member
    Posted 2 years ago #

    Hi,

    I have a form with a date field and Date of Birth check activated on it.
    My site is in italian so it uses bpxs-it_IT.po with names of months translated.
    The select for months as options tag like these:

    <option value="February">Febbraio<!-- this is translated :) --></option>

    I noticed that DOB control didn't work and I saw that function bpxs_get_month_number uses translated months names to extract the month number and so no month matched.

    So in function bpxs_get_month_number I replaced

    $names = array(
        1  => __( 'January', 'bpxs' ),
        2  => __( 'February', 'bpxs' ),
        3  => __( 'March', 'bpxs' ),
        4  => __( 'April', 'bpxs' ),
        5  => __( 'May', 'bpxs' ),
        6  => __( 'June', 'bpxs' ),
        7  => __( 'July', 'bpxs' ),
        8  => __( 'August', 'bpxs' ),
        9  => __( 'September', 'bpxs' ),
        10 => __( 'October', 'bpxs' ),
        11 => __( 'November', 'bpxs' ),
        12 => __( 'December', 'bpxs' )
    );

    with

    $names = array(
      1  => 'January',
      2  => 'February',
      3  => 'March',
      4  => 'April',
      5  => 'May',
      6  => 'June',
      7  => 'July',
      8  => 'August',
      9  => 'September',
      10 => 'October',
      11 => 'November',
      12 => 'December'
    );

    now it works.

    Fixed a bug or did something wrong somewhere else? :)

    http://wordpress.org/extend/plugins/bp-xtra-signup/

  2. teonsight
    Member
    Posted 2 years ago #

    I added

    $d = substr('00'.$d, -2);
    $m = substr('00'.$m, -2);

    in function bpxs_check_dob before

    $age = ( date( "md" ) < $m . $d ) ? date( "Y" ) - $y - 1 : date( "Y" ) - $y;

    Otherwise there were errors in month+date comparison (the ones coming from user selection can be 1+1 digit while date( "md" ) is always 2+2).

    Guess there's something wrong with what I did...but I just used the BP date field...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic