Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change Year Range of the core Birthday picker in registration page

  • @angaragsandilya

    Participant

    I want to change the default year-range (that is set to 1920-1998 currently) in the core Birthday picker on the default site registration page. I don’t want to add any custom field, but edit the year range of the core Birthday field only. Please help ASAP!

Viewing 2 replies - 1 through 2 (of 2 total)
  • @djpaul

    Keymaster

    I don’t know how easy this might be to change at the moment – I think someone would have to write a small plugin – but we are tracking this feature request at https://buddypress.trac.wordpress.org/ticket/5500 for inclusion in a future BuddyPress release.

    @danbp

    Participant

    Hi

    you can use this snippet from within bp-custom.php to change the default year range in the profile field datepicker (1902 – 2035). In the example, you will get 1950 – 2020

    function custom_bp_datebox($html, $type, $day, $month, $year, $field_id, $date) {      
        if($type == 'year'){
       
            $html = '<option value=""' . selected( $year, '', false ) . '>----</option>';
     
            for ( $i = 2020; $i > 1949; $i-- ) {
                    $html .= '<option value="' . $i .'"' . selected( $year, $i, false ) . '>' . $i . '</option>';
            }
        }
        return $html;
    }
    add_filter( 'bp_get_the_profile_field_datebox', 'custom_bp_datebox',10,7);

    Tested with BP 2.5 and a third party theme. Hope it helps you. 😉

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change Year Range of the core Birthday picker in registration page’ is closed to new replies.
Skip to toolbar