marcbelletre / acf-rrule Goto Github PK
View Code? Open in Web Editor NEWRRule field for Advanced Custom Field
License: MIT License
RRule field for Advanced Custom Field
License: MIT License
Thanks so much for your work on this plugin, it's very handy!
I ran into one issue. If you enter an end date that is before the start date, or an end date that results in there being no occurrences (e.g. the recurrence is weekly on Wednesday, but there are no Wednesdays between the start and end date), PHP throws an error.
Adding validation for these cases would be great, in case a user enters something invalid.
Thanks again!
Wordpress 6.5 is introducing plugin dependencies.
A request has been made to the ACF Pro team to update their plugin so ACF RRule can require either ACF or ACF Pro.
The update is ready and will be released when ACF Pro is updated as well.
The start_time TimePicker won't open when I click on it, and instead throws this error:
//jquery-ui-timepicker-addon.min.js?ver=1.6.1:1
Uncaught TypeError: Cannot read properties of null (reading 'replace')
at $.datepicker.parseTime (jquery-ui-timepicker-addon.min.js?ver=1.6.1:1:25936)
at Timepicker._parseTime (jquery-ui-timepicker-addon.min.js?ver=1.6.1:1:7656)
at Timepicker._addTimePicker (jquery-ui-timepicker-addon.min.js?ver=1.6.1:1:7035)
at $.datepicker._updateDatepicker (jquery-ui-timepicker-addon.min.js?ver=1.6.1:1:30029)
at HTMLInputElement._showDatepicker (datepicker.js?ver=1.13.2:834:16)
at HTMLInputElement.dispatch (jquery.js?ver=3.6.1:5430:27)
at elemData.handle (jquery.js?ver=3.6.1:5234:28)
Hi Marc,
I hope you're doing well. :)
I'd like to propose changing the underlying RRule library from Recurr to php-rrule.
As I was digging into my current project where I'm utilizing the ACF RRule Plugin, I've noticed some issues with Recurr as a library. Easily noted is that the Recurr library is not updated frequently and had gone nearly a year without any updates. It has months-old pending PRs to bring it into RFC compliance (specifically a big bug around parsing RRules with timezones/TZID listed).
The php-rrule
project seems to have a much more reliable beat/tempo of commits by the maintainer(s), issues and PRs don't seem nearly as stale. I've played around with it in a scratchpad PHP env, and it seems pretty solid. I also like that it has a build in method occursAt()
which enables the ability to check a date against an existing RRule. It also offers features around finding occurrences between two points in time, so we could implement some sort of pagination functionality like I discussed in #3.
I'm going to go ahead and implement replacing Recurr with php-rrule
in my custom version of ACF RRule Plugin that I'm using, but I'm wondering how you'd feel if I PRed this replacement into the project?
Uncaught Exception: DateTimeZone::__construct(): Unknown or bad timezone
/wp-content/plugins/acf-rrule-field/vendor/simshaun/recurr/src/Recurr/Rule.php on line 804
Hello,
Not sure if it's a bug or not. But when the end_type is set to count, there is no end_date generated?
HI! Thank you so much for the plugin!
I just faced a small issue.
When the recurrence is set to weekly for example, but weekdays are not selected, on post save/update (only for drafts, published post update seems to be ok) it displays a critical error.
Is there a way to show a warning instead? None of my clients is technical so they sometimes forget by accident to set the occurrence and end up with a critical error when saving a post
Hello,
After the 1.4 update, the field doesn't appear anymore in the back office when i'm writing a post. The label is the only thing visible on the field.
Wordpress version is 6.4.2 and ACF version is 6.2.4. I use a custom theme with Timber 2 as a framework.
It worked wonderfully last week when i used it in my website, but since i made the update it won't work. I tried changing the ID but it didn't solve the issue. Any idea why it's not working ?
Thanks again for your work on this plugin.
I ran into a specific case where I need to set something to recur on the 2nd and 4th Thursday of every month. With the current implementation of the plugin, if I select...
...it is only possible to select either the 2nd or the 4th Thursday, but not both. From looking at RRULE itself, it seems that it is indeed possible to do what I'm looking to do, but that the ACF implementation doesn't account for this scenario. Would that be possible to add? Or is there a way to do this that I'm missing?
Thanks again for you work on this plugin and thanks in advance for your help with this snag!
Add an option to the RRule field to set the end date using DTEND
.
DTEND
attribute.
Hi,
There's a small bug in the "Start time" french translation. It should be translated "Heure de début".
Hi @marcbelletre,
Congrats for this amazing plugin :)
I was translating it in wp.org and the files acf-rrule-xx_XX.po/.mo
aren't being loaded from the wp-content/languages folder.
The issue is that the textdomain wp.org is using to name the files is 'acf-rrule-field'
and not 'acf-rrule'
.
You should rename the textodomain to 'acf-rrule-field'
so that all translations are properly loaded, and of course, if you want to load local .po/.mo files, also rename it to acf-rrule-field-xx_XX.po/.mo
.
Would you like a PR with this fix?
Thanks :-)
Hey there,
I'm trying to get this to work, but when retrieving the value all arrays are strings ("Array"):
["dates_collection"]=> string(5) "Array"
Inside load_value() all the data is there, but when querying get_field('repeat', $event->ID) inside a template file results in all arrays beeing converted.
Before looking into my own setup: Is this maybe a known issue with latest ACF/ACFP versions?
Thanks!
Sebastian
I have a recurring event every wednesday at 7. However, on the front end of the site it's only showing one night. Is there something I should do?
Hello,
When setting the frequency to montly you have the option of setting it on a monthday or weekday basis.
When selecting weekdays the checkmarks with wich week of that month the selected day(s) applies to doesn't save, or at least doesn't show the saved value.
Hope that makes any sense, if not i'll gladly elaborate
I registered a Custom Post Type using Advanced Custom Fields, created a new field group that contained an ACF RRule field, and ended up with a Javascript Error.
This seems to happen only when the I've got the rule attached to the Gutenberg editor. If I switch to the classic editors the javascript error isn't present.
I tried to wrap the following:
acf.add_action('ready_field/type=rrule', initialize_field);
acf.add_action('append_field/type=rrule', initialize_field);
with:
jQuery( document ).ready( function( $ ) {
if ( typeof acf !== 'undefined' ) {
console.log( 'ACF is defined', acf );
}
});
as outlined in the ACF Javascript API doc and that seems to get rid of the JS error, but the 'end rules' don't seem to be initializing.
I'm not that great with jQuery so I hope this helps to describe the issue. Let me know if I can clarify.
Not sure why no-one else has run across this, When I set the end date witht the picker to e.g. 2023-04-23, it changes after saving to 2023-04-22. This happens even if the start_date is the same, in which case I end up with the end_date one day earlier than the start date.
The site I'm using this on has timezone set to Los Angeles, but I changed it to UTC and it still malfunctions.
doing some debugging, If I log like this:
switch ($value['end_type']) {
case 'date':
if ($value['end_date']) {
$end_date = \DateTime::createFromFormat('Ymd', $value['end_date']);
$end_date->setTime(0, 0, 0);
error_log('end dateTime: ' . $end_date->format('Y-m-d H:i:s'));
$rule->setUntil($end_date);
$until = $rule->getUntil();
error_log('Until: ' . $until->format('Y-m-d H:i:s'));
}
I get
end dateTime: 2023-04-23 00:00:00
Until: 2023-04-22 17:00:00
If I change the code above like so:
$end_date->setTime(23, 0, 0);
I get
end dateTime: 2023-04-23 00:00:00
Until: 2023-04-23 15:00:00
So Maybe the problem is in simshaun/recurr, but it could be the problem is the DateTime object that's passed to recurr.
Maybe this doesn't break for people at or east of Greenwich? If you change the time to 23 hrs, will it malfunction for people further east?
Hi, thank you for your work on this !
I got an error that i'm not able to reproduce in every situation but that I feel could be critical somehow:
When the rrule field is shown in the post edit screen, the start date is shown empty.
If the user then saves the post without setting the start_date field, an error is thrown (I only met this error when using the rrule field inside a complex nested rules setup that includes a repeater field) :
Error thrown with message "Call to a member function setTime() on bool"
Stacktrace:
#80 Error in /srv/www/strada/public_html/web/app/plugins/acf-rrule/fields/class-acf-field-rrule.php:850
#79 acf_field_rrule:update_value in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:289
#78 call_user_func_array in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:289
#77 WP_Hook:apply_filters in /srv/www/strada/public_html/web/wp/wp-includes/plugin.php:249
#76 apply_filters_ref_array in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-hook-functions.php:101
#75 _acf_apply_hook_variations in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:287
#74 call_user_func_array in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:287
#73 WP_Hook:apply_filters in /srv/www/strada/public_html/web/wp/wp-includes/plugin.php:206
#72 apply_filters in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:185
#71 acf_update_value in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-group.php:225
#70 acf_field__group:update_value in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:289
#69 call_user_func_array in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:289
#68 WP_Hook:apply_filters in /srv/www/strada/public_html/web/wp/wp-includes/plugin.php:249
#67 apply_filters_ref_array in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-hook-functions.php:101
#66 _acf_apply_hook_variations in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:287
#65 call_user_func_array in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:287
#64 WP_Hook:apply_filters in /srv/www/strada/public_html/web/wp/wp-includes/plugin.php:206
#63 apply_filters in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:185
#62 acf_update_value in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-repeater.php:760
#61 acf_field_repeater:update_row in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-repeater.php:856
#60 acf_field_repeater:update_value in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:289
#59 call_user_func_array in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:289
#58 WP_Hook:apply_filters in /srv/www/strada/public_html/web/wp/wp-includes/plugin.php:249
#57 apply_filters_ref_array in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-hook-functions.php:101
#56 _acf_apply_hook_variations in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:287
#55 call_user_func_array in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:287
#54 WP_Hook:apply_filters in /srv/www/strada/public_html/web/wp/wp-includes/plugin.php:206
#53 apply_filters in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:185
#52 acf_update_value in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-group.php:225
#51 acf_field__group:update_value in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:289
#50 call_user_func_array in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:289
#49 WP_Hook:apply_filters in /srv/www/strada/public_html/web/wp/wp-includes/plugin.php:249
#48 apply_filters_ref_array in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-hook-functions.php:101
#47 _acf_apply_hook_variations in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:287
#46 call_user_func_array in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:287
#45 WP_Hook:apply_filters in /srv/www/strada/public_html/web/wp/wp-includes/plugin.php:206
#44 apply_filters in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:185
#43 acf_update_value in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-group.php:225
#42 acf_field__group:update_value in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:289
#41 call_user_func_array in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:289
#40 WP_Hook:apply_filters in /srv/www/strada/public_html/web/wp/wp-includes/plugin.php:249
#39 apply_filters_ref_array in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-hook-functions.php:101
#38 _acf_apply_hook_variations in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:287
#37 call_user_func_array in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:287
#36 WP_Hook:apply_filters in /srv/www/strada/public_html/web/wp/wp-includes/plugin.php:206
#35 apply_filters in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:185
#34 acf_update_value in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-group.php:225
#33 acf_field__group:update_value in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:289
#32 call_user_func_array in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:289
#31 WP_Hook:apply_filters in /srv/www/strada/public_html/web/wp/wp-includes/plugin.php:249
#30 apply_filters_ref_array in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-hook-functions.php:101
#29 _acf_apply_hook_variations in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:287
#28 call_user_func_array in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:287
#27 WP_Hook:apply_filters in /srv/www/strada/public_html/web/wp/wp-includes/plugin.php:206
#26 apply_filters in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:185
#25 acf_update_value in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-repeater.php:760
#24 acf_field_repeater:update_row in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-repeater.php:856
#23 acf_field_repeater:update_value in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:289
#22 call_user_func_array in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:289
#21 WP_Hook:apply_filters in /srv/www/strada/public_html/web/wp/wp-includes/plugin.php:249
#20 apply_filters_ref_array in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-hook-functions.php:101
#19 _acf_apply_hook_variations in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:287
#18 call_user_func_array in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:287
#17 WP_Hook:apply_filters in /srv/www/strada/public_html/web/wp/wp-includes/plugin.php:206
#16 apply_filters in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:185
#15 acf_update_value in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:230
#14 acf_update_values in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-form-functions.php:158
#13 _acf_do_save_post in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:287
#12 call_user_func_array in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:287
#11 WP_Hook:apply_filters in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:311
#10 WP_Hook:do_action in /srv/www/strada/public_html/web/wp/wp-includes/plugin.php:478
#9 do_action in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/acf-form-functions.php:136
#8 acf_save_post in /srv/www/strada/public_html/web/app/mu-plugins/advanced-custom-fields-pro/includes/forms/form-post.php:313
#7 ACF_Form_Post:save_post in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:289
#6 call_user_func_array in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:289
#5 WP_Hook:apply_filters in /srv/www/strada/public_html/web/wp/wp-includes/class-wp-hook.php:311
#4 WP_Hook:do_action in /srv/www/strada/public_html/web/wp/wp-includes/plugin.php:478
#3 do_action in /srv/www/strada/public_html/web/wp/wp-includes/post.php:4260
#2 wp_insert_post in /srv/www/strada/public_html/web/wp/wp-includes/post.php:4354
#1 wp_update_post in /srv/www/strada/public_html/web/wp/wp-admin/includes/post.php:419
#0 edit_post in /srv/www/strada/public_html/web/wp/wp-admin/post.php:227
I don't get this error if I manually set a start_date before saving the post.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.