Skip to content

Conversation

@carstingaxion
Copy link
Collaborator

@carstingaxion carstingaxion commented Oct 21, 2024

This PR is the final part of the fragmentation of #831, which was way too big to review or merge.
I try to do better in the future.

Finally closes #603

Description of the Change

This PR introduces the following of new endpoints:

  • example.org/event/my-sample-event/ical

    provides a download-able .ics file in ical format.

  • example.org/event/my-sample-event/outlook

    provides the same download-able file as an alias.

  • example.org/event/my-sample-event/google-calendar

    redirects to create a new event in Google Calendar.

  • example.org/event/my-sample-event/yahoo-calendar

    redirects to create a new event in Yahoo Calendar.

  • example.org/event/feed/ical

    provides a subscribe-able event feed in ical format with all events of the site.

  • example.org/venue/my-sample-venue/feed/ical

    provides a subscribe-able event feed in ical format with all events at that venue.

  • example.org/topic/my-sample-topic/feed/ical

    provides a subscribe-able event feed in ical format with all events grouped into that topic.

How to test the Change

  • Test the Add to Google calendar
    1. (You need an google account & use their calendar)
    2. Go to the frontend of any event and hit the the Add to calendar > Google button
    3. Confirm that the drafted event in the Google calendar matches the GatherPress event
  • Test the Add to Yahoo calendar
    1. (You need an yahoo account & use their calendar)
    2. Go to the frontend of any event and hit the the Add to calendar > Yahoo button
    3. Confirm that the drafted event in the Yahoo calendar matches the GatherPress event
  • create a ical-download.php file and put it at the root of your active theme to overwrite the plugin template
    1. Create that file
    2. Put some echo ‚hello themed iCal world‘; into it
    3. Go to the frontend of any event and hit the the Add to calendar > iCal button (to make use of your template)
  • https://icalendar.org/validator.html

Changelog Entry

Added - New URL endpoints for subscribe-able ical feeds for events, venues & topics

Credits

Props @carstingaxion

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

Related PRs that can be reviewed & merged after this:

To get the new endpoints into the block-editor, one of the following would be required:

@carstingaxion carstingaxion changed the title new calendar endpoints | part 4/n | endpoint implementations new calendar endpoints | part 4/4 | endpoint implementations Oct 21, 2024
@carstingaxion carstingaxion marked this pull request as ready for review October 25, 2024 01:25
carstingaxion

This comment was marked as outdated.

@carstingaxion carstingaxion requested a review from mauteri October 25, 2024 01:34
@carstingaxion
Copy link
Collaborator Author

Hello @mauteri ,

can you please help me getting this finished?
I added some review-comments, where I don't know how to go on.

Would be nice to get your feedback or help or both!

@MervinHernandez
Copy link
Collaborator

Thank you @carstingaxion // acknowledging this is ready for review.
I will schedule actions into reviewing this as soon as possible.

@carstingaxion
Copy link
Collaborator Author

Seeing this here makes me feel sad.

After a lot of work I did, I asked for help, tried to do better, asked for help another time and after month this contribution is still on hold.

Excuse me @mauteri, @MervinHernandez, @patriciabt and all others but …. 👀

@mauteri
Copy link
Contributor

mauteri commented Jul 7, 2025

Hi @carstingaxion I'm sorry you felt you didn't get the support you needed. Without a project manager it is very hard and I'm sorry for that. I'm in the process of recruiting one, but there was a shakeup at my company recently, so I'm not sure what the status is of the person I had in mind to help prioritize tasks and rally people around issues.

This current task was lined up to be worked on for next release but the person who knows a bit about this and was interested in working on is another coworker of mine, and is effected by the same shakeup I mentioned before, so not sure when/if he'll get back to it.

If you're interested in joining back up with us, we'd love to have you. Hope you're well.

@mauteri
Copy link
Contributor

mauteri commented Jul 12, 2025

@JordanPak mind working with @carstingaxion on this one? Thx!

(... to avoid the never ending rebase merge conflicts, that apperaed when I tried to update the aged PR#955 to "develop" after months of commits happened.)

Included were 18 commits:

---

commit 3d2dfe6
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Fri Oct 25 02:11:52 2024 +0200

    Fix: MD049/emphasis-style Emphasis style should be consistent

commit 65f00a9
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Fri Oct 25 02:07:32 2024 +0200

    Ignore phpstan error (probably introduced with GatherPress#928)

commit 48244f6
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Tue Oct 22 10:24:29 2024 +0200

    Fix: Parameter #1 $string of function str_pad expects string, int given

commit b70ef88
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Tue Oct 22 10:21:56 2024 +0200

    Fix: Access to undefined constant GatherPress\Core\Calendars::DATETIME_FORMAT.

commit a0dfc36
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Tue Oct 22 10:20:03 2024 +0200

    Fix: PHPDoc tag @throws with type GatherPress\Core\Exception is not subtype of Throwable

commit acd837b
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Tue Oct 22 10:18:55 2024 +0200

    Fix: Offset 'type' on array{url: string|false, attr: string} in isset() does not exist.

commit 6ddf147
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Tue Oct 22 10:14:51 2024 +0200

    Fix: Parameter #1 $object_type of function get_object_taxonomies expects array<string>|string|WP_Post, int given.

commit 0ffbcba
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Tue Oct 22 10:11:42 2024 +0200

    BUGFIX: Remove superflous file

commit b028af0
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Tue Oct 22 10:03:47 2024 +0200

    Fix: Function is_archive invoked with 1 parameter, 0 required.

commit 8f33582
Merge: 34ad38e 6478e00
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Tue Oct 22 01:47:58 2024 +0200

    Merge branch 'develop' into feature/fragment-of-pr-831-endpoint-implementations

commit 34ad38e
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Tue Oct 22 01:42:12 2024 +0200

    Fix for CS

commit 13aaf22
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Tue Oct 22 01:39:56 2024 +0200

    NEW '.../topic/123/ical' endpoint

commit 878159f
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Tue Oct 22 01:39:25 2024 +0200

    NEW '.../venue/abc/ical' endpoint

commit 6633ec5
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Tue Oct 22 01:38:57 2024 +0200

    NEW '.../event/xyz/ical' endpoint

commit 883a819
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Tue Oct 22 01:38:20 2024 +0200

    NEW '.../event/ical' endpoint

commit 29a39b1
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Tue Oct 22 01:26:49 2024 +0200

    Add overrideable-templates , like described in GatherPress#929

commit 3eb3d6c
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Tue Oct 22 01:18:25 2024 +0200

    Add 'Add-to-calendar' to feature list

commit fe58c49
Author: Carsten Bach <mail@carsten-bach.de>
Date:   Tue Oct 22 00:13:39 2024 +0200

    New class responsible for managing calendar-related endpoints in GatherPress.
@carstingaxion carstingaxion force-pushed the feature/fragment-of-pr-831-endpoint-implementations branch from 3d2dfe6 to e5813a4 Compare July 23, 2025 15:16
@carstingaxion
Copy link
Collaborator Author

carstingaxion commented Jul 25, 2025

To be able to go on here, I do need especially your help @mauteri!

Because it was you who prepared & merged #1068 , which includes some of the same functionality of this PR. How should I - for example - handle all your code related to .ics file downloads, which is also included here, too?

(EDIT)

And I absolutely do not understand, why you create new solutions beside the working ones I provided months ago, without even leaving a comment.

@github-actions
Copy link
Contributor

Preview changes with Playground

You can preview the recent changes for PR#955 with the following PHP versions:

PHP Version 8.3

PHP Version 7.4

Download .zip with build changes

Made with 💙 from GatherPress & a little bit of WordPress Playground. Changes will not persist between sessions.

@mauteri
Copy link
Contributor

mauteri commented Jul 27, 2025

To be able to go on here, I do need especially your help @mauteri!

Because it was you who prepared & merged #1068 , which includes some of the same functionality of this PR. How should I - for example - handle all your code related to .ics file downloads, which is also included here, too?

(EDIT)

And I absolutely do not understand, why you create new solutions beside the working ones I provided months ago, without even leaving a comment.

@carstingaxion you were gone for about 10 months and didn’t respond to any of the messages I tagged you in during that time. Eventually, I had to move forward. I needed to update the Add to Calendar block and also fix the downloadable .ics functionality. The current implementation matches what sites like meetup.com offer (single downloadable events rather than a subscribable feed). I saw the subscribable feature as something we could layer in later.

Your approach here feels quite complex and heavily abstracted. I’m not sure how I feel about it yet, and I’d appreciate you looping in @JordanPak, since he’s worked on subscribable calendar links in some of his own work.

@carstingaxion
Copy link
Collaborator Author

GitHubs Copilot do not have permission to directly add a review file or comment to the PR. However, here is a detailed review that you can copy and paste directly into the PR as a review comment or summary:


Pull Request Review for PR #955: New Calendar Endpoints

Overview

This PR introduces new calendar-related endpoints and enhances the "Add to Calendar" block for GatherPress, enabling users to easily add events to Google, Yahoo, iCal, and Outlook calendars. The implementation is modular, extensible, and aligns with WordPress and plugin coding best practices.


File-by-File Summary

  • class-add-to-calendar.php
    Handles the Add to Calendar block, dynamically replaces placeholder links with real calendar URLs, and integrates with event metadata.

    • Strengths: Uses hooks and singleton pattern; easy to extend.
    • Suggestion: Ensure all user-facing strings are translated.
  • class-event-setup.php
    Registers rewrite rules and query vars for .ics endpoints; serves dynamically generated iCal files.

    • Strengths: Clean endpoint handling; correct HTTP headers for downloads.
    • Suggestion: Add tests for rewrite rule registration and ICS output.
  • class-event.php
    Centralizes calendar link generation for Google, iCal, Outlook, and Yahoo.

    • Strengths: Single source for all event calendar links; easy to extend.
    • Suggestion: Validate calendar descriptions for XSS risks.
  • src/blocks/add-to-calendar/
    Block definition, template, and block.json for the Add to Calendar block.

    • Strengths: User-friendly block interface; clear separation of presentation and logic.
    • Suggestion: Ensure block options are customizable for site admins.
  • Documentation

    • User and developer documentation is up-to-date and helpful.

General Feedback

  • Extensibility: The architecture allows for future expansion and easy integration with additional calendar services.
  • Testing: Consider expanding test coverage, especially for new endpoint handlers and calendar file output.
  • Security: Make sure all dynamic content (especially descriptions) is sanitized for calendar exports.

Suggestions

  1. Comprehensive iCal Validation: Test .ics output with various clients and use a validator service.
  2. Security Checks: Review all new endpoints for sanitization and escaping.
  3. User Feedback: Consider adding success/failure indicators when exporting or subscribing to calendars.
  4. Internationalization: Double-check all new user-facing strings for translatability.

Conclusion:
This is a well-implemented and much-needed feature set for GatherPress. With minor improvements in testing and security, this code will be robust and maintainable. Excellent work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add subscribeable Ical feeds

3 participants