Forum Replies Created

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • in reply to: Datepicker – blockout weekends and specific days #2330
    kbrands
    Participant

    Thank you Ally! That code worked a treat!!! πŸ™‚

    in reply to: Datepicker – blockout weekends and specific days #2321
    kbrands
    Participant

    Here it is…sorry…I’m a bit of a newb πŸ™‚


    function mytheme_get_dates_to_disable()
    {
    return array(
    '2013-1-26',
    '2013-1-28',
    '2013-3-29',
    '2013-4-1',
    '2013-4-25',
    '2013-6-10',
    '2013-7-10',
    '2013-12-25',
    '2013-12-26',
    '2014-1-1',
    '2014-1-27',
    '2014-4-1',
    '2014-4-18',
    '2014-4-21',
    '2014-4-25',
    '2014-6-9',
    '2014-10-6',
    '2014-12-25',
    '2014-12-26',
    '2015-1-1',
    '2015-1-26',
    '2015-4-3',
    '2015-4-6',
    '2015-6-8',
    '2015-10-5',
    '2015-12-25',
    '2015-12-28',
    '2016-1-1',
    '2016-1-26',
    '2016-3-25',
    '2016-3-28',
    '2016-4-25',
    '2016-6-13',
    '2016-10-3',
    '2016-12-26',
    '2016-12-27'
    );
    }

    function mytheme_prevent_specific_dates($valid, $value, $element)
    {
    if ($valid) {
    $disabledDates = mytheme_get_dates_to_disable();
    $submittedDate = "{$value['year']}-{$value['month']}-{$value['day']}";

    if (in_array($submittedDate, $disabledDates)) {
    $element->addError('That date is not available');
    $valid = false;
    }
    }

    return $valid;
    }
    add_filter('iphorm_element_valid_iphorm_1_23', 'mytheme_prevent_specific_dates', 10, 3);

    function mytheme_datepicker_prevent_specific_dates($options, $dpMinYear, $dpMaxYear, $element)
    {
    return "{
    beforeShowDay: function (date) {
    if (quformDisabledDates) {
    for (var i = 0; i < quformDisabledDates.length; i++) {
    var parts = quformDisabledDates[i].split('-');
    if (date.getFullYear() == parts[0] && (date.getMonth()+1) == parts[1] && date.getDate() == parts[2]) {
    return [false];
    }
    }
    }
    return [true];
    }
    }";
    }
    add_filter('iphorm_datepicker_options_iphorm_1_23', 'mytheme_datepicker_prevent_specific_dates', 10, 4);
    function mytheme_print_dates_to_disable()
    {
    ?>
    <script type="text/javascript">
    var quformDisabledDates = <?php echo json_encode(mytheme_get_dates_to_disable()); ?>;
    </script>
    <?php
    }
    add_action('wp_head', 'mytheme_print_dates_to_disable');

    function mytheme_datepicker_block_days($options, $dpMinYear, $dpMaxYear, $element)
    {
    return "{
    beforeShowDay: function (date) {
    var day = date.getDay();
    if (day == 0 || day == 6) {
    // It's a Sunday or Saturday, block the date
    return [false, ''];
    } else {
    return [true, ''];
    }
    }
    }";
    }
    add_filter('iphorm_datepicker_options_iphorm_1_23', 'mytheme_datepicker_block_days', 10, 4);
    function mytheme_block_days($valid, $value, $element)
    {
    if ($valid) {
    $time = strtotime("{$value['year']}-{$value['month']}-{$value['day']}");
    $day = date('w', $time);

    if ($day == 0 || $day == 6) {
    $element->addError('Please choose another day');
    $valid = false;
    }
    }

    return $valid;
    }
    add_filter('iphorm_element_valid_iphorm_1_23', 'mytheme_block_days', 10, 3);

    in reply to: Datepicker – blockout weekends and specific days #2314
    kbrands
    Participant

    Thank you for your reply. I apologise for the delay in mine…changed hosts and lost access for a few days. I tried adding the code you provided but I fear I have not put it in the right spot as the specific days are blocked out but not the weekends πŸ™ I have included the full function code I currently have below…I would appreciate it if you could advise how I should be structuring it as I find myself a bit clueless at this point… Thank you!

    function mytheme_get_dates_to_disable()
    {
    return array(
    β€˜2013-1-26’,
    β€˜2013-1-28’,
    β€˜2013-3-29’,
    β€˜2013-4-1’,
    β€˜2013-4-25’,
    β€˜2013-6-10’,
    β€˜2013-7-10’,
    β€˜2013-12-25’,
    β€˜2013-12-26’,
    β€˜2014-1-1’,
    β€˜2014-1-27’,
    β€˜2014-4-1’,
    β€˜2014-4-18’,
    β€˜2014-4-21’,
    β€˜2014-4-25’,
    β€˜2014-6-9’,
    β€˜2014-10-6’,
    β€˜2014-12-25’,
    β€˜2014-12-26’,
    β€˜2015-1-1’,
    β€˜2015-1-26’,
    β€˜2015-4-3’,
    β€˜2015-4-6’,
    β€˜2015-6-8’,
    β€˜2015-10-5’,
    β€˜2015-12-25’,
    β€˜2015-12-28’,
    β€˜2016-1-1’,
    β€˜2016-1-26’,
    β€˜2016-3-25’,
    β€˜2016-3-28’,
    β€˜2016-4-25’,
    β€˜2016-6-13’,
    β€˜2016-10-3’,
    β€˜2016-12-26’,
    β€˜2016-12-27’
    );
    }

    function mytheme_prevent_specific_dates($valid, $value, $element)
    {
    if ($valid) {
    $disabledDates = mytheme_get_dates_to_disable();
    $submittedDate = β€œ{$value[β€˜year’]}-{$value[β€˜month’]}-{$value[β€˜day’]}”;

    if (in_array($submittedDate, $disabledDates)) {
    $element->addError(β€˜That date is not available’);
    $valid = false;
    }
    }

    return $valid;
    }
    add_filter(β€˜iphorm_element_valid_iphorm_1_23’, β€˜mytheme_prevent_specific_dates’, 10, 3);

    function mytheme_datepicker_prevent_specific_dates($options, $dpMinYear, $dpMaxYear, $element)
    {
    return β€œ{
    beforeShowDay: function (date) {
    if (quformDisabledDates) {
    for (var i = 0; i

    var quformDisabledDates = ;

    <?php
    }
    add_action('wp_head', 'mytheme_print_dates_to_disable');
    return "{
    beforeShowDay: function (date) {
    if (quformDisabledDates) {
    for (var i = 0; i < quformDisabledDates.length; i++) {
    var parts = quformDisabledDates[i].split('-');
    if (date.getFullYear() == parts[0] && (date.getMonth()+1) == parts[1] && date.getDate() == parts[2]) {
    return [false];
    }
    }
    }

    var day = date.getDay();
    if (day == 0 || day == 6) {
    // It's a Sunday or Saturday, block the date
    return [false, ''];
    } else {
    return [true, ''];
    }
    }
    }";

    in reply to: "Please select" for dropdown menus #2109
    kbrands
    Participant

    So easy! I promise I did try and find the answer myself but clearly I missed the advised post. Thank you again Ally!

    in reply to: Update failed – crashed site #2050
    kbrands
    Participant

    All fixed thank you Ally! It was an issue on the hosting/server end. I really appreciate the assistance you provided! πŸ™‚

    in reply to: Update failed – crashed site #2048
    kbrands
    Participant

    Oh, I’m sorry, one more thing…could the update to wordpress 3.5 have caused this?

    in reply to: Update failed – crashed site #2047
    kbrands
    Participant

    Thanks again for your response. I tried viewing in explorer (I usually use firefox) and the same errors are coming up. I will contact my hosting company now and see what they have to say. Thanks Ally. πŸ™‚

    in reply to: Update failed – crashed site #2044
    kbrands
    Participant

    Thank you for your prompt response. I applied your instructions and the plugin installed successfully and showed up in my WP plugins page, I activated it and the forms were still there as advised. However, the same error messages came up. I have taken a screen shot of the error messages and attached for you. Thanks in advance for your continued assistance πŸ™‚

    Attachments:
    You must be logged in to view attached files.
Viewing 8 posts - 1 through 8 (of 8 total)
Be inspired. Β© 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy