Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author donmik

    (@atallos)

    Ummm, Your best chance is possibly hide the year component with css and then use the filter to modify the way the birthdate is displayed if you want.

    You need also to fix the year to a leap-year to be sure you have 29 days in february just in case somebody needs it. You can probably achieve this with javascript or using the filter: “bp_get_the_profile_field_birthdate” you can change the selected year value.

    Thread Starter aswain1

    (@aswain1)

    That makes a lot of sense, thank you.

    Can you help me out on how/where to implement that “bp_get_the_profile_field_birthdate” filter? I have tried putting it in my functions.php file but it doesn’t seem to be working.

    Plugin Author donmik

    (@atallos)

    add_filter( 'bp_get_the_profile_field_birthdate', 'my_profile_field_birthdate', 10, 2);
    function my_profile_field_birthdate($html, $type) {
        // Check if $type is "year" and not "day" or "month".
        if ($type === 'year') {
            // Modify to only an option with a leap-year like 2016.
            $html = '<option value="2016">2016</option>';
        }
    
        return $html;
    }
    Thread Starter aswain1

    (@aswain1)

    Works perfectly, thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Completely Remove Year From Birthdate’ is closed to new replies.