Home Forums Plugin Support WP User Frontend Pro Jquery Datepicker Customization

This topic is: resolved

Tagged: 

This topic contains 3 replies, has 3 voices, and was last updated by  jman057 5 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #9587

    hughs
    Participant
    Post count: 42

    I have purchased WPUF Pro and want to buy the Buddypress Profile Integration Add-on but need to make sure that I can customize the jquery date-picker to work with the Birthdate field in my Buddypress site.
    I want to add a year drop-down or year navigation buttons to the date-picker jquery calendar so that users can click to their year and then navigate to the month and pick the day. As of now there is are only buttons to go forward and backwards by month.
    I also want to set the default date to January, 24 1990 which is a more realistic date for someone signing up to my site.

    First, can you tell me where to find the code for the jquery date picker and can you take a look at the code below to see if it will work:


    $.datepicker.setDefaults($.extend({changeYear: true}));
    $("#datepicker_open").click(function(){
    $("#datepicker").datepicker(
    "dialog",
    "23.01.1990",
    function(){
    alert("Event onSelect");
    },
    { showButtonPanel: true }
    );
    });

    If this will work can you give me instructions on where to put this code.
    Thanks a lot!

    #9619

    Tareq Hasan
    Keymaster
    Post count: 2831

    [php]
    function wpufe_set_datepicker() {
    ?>
    <script type="text/javascript">
    jQuery(function($) {
    $.datepicker.setDefaults({
    changeYear: true,
    changeMonth: true,
    defaultDate: new Date(1990, 0, 24)
    });
    });
    </script>
    <?php
    }

    add_action( ‘wp_head', ‘wpufe_set_datepicker' );
    [/php]

    Add this to your themes functions.php and you'll have year and month dropdown and set the default date to January, 1990

    #9628

    hughs
    Participant
    Post count: 42

    Thanks Tareq,
    I tested the above code in the WPUF registration and it works great. I am assuming it will format the date in the correct Buddypress format in the Buddypress Integration add-on.
    Thanks again!

    #17508

    jman057
    Participant
    Post count: 16

    I added this to make sure I could select an appropriate date range

    yearRange: '-90:+1'

    Thanks for the solution!

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

The topic ‘Jquery Datepicker Customization’ is closed to new replies.