Home › Forums › Calendar Products › Event Aggregator › iCal does not (re)import events which have been deleted by mistake in wordpress
- This topic has 4 replies, 2 voices, and was last updated 10 years, 9 months ago by
Brook.
-
AuthorPosts
-
August 3, 2015 at 10:53 am #992794
Carla Dagnone
ParticipantHello,
I am using iCal to import events from a public Google calendar (ics import ) .
The first import worked very well . Then I decided to test the recurring import to make sure that events created in the future would be uploaded corrected and I deleted (trashed completely) a few events in WordPress and run the import again .
It turns out that I can NOT re-import these events again as if , somehow, the iCal module had kept the info that the event had been deleted.Is there a way to fix this and force the missing events to be imported again?
Thank you,
Lisianne
August 3, 2015 at 3:50 pm #992915Carla Dagnone
ParticipantUPDATE : I just found that this behavior of iCal is mentioned at the very bottom of this page of the knowledgeDB
https://theeventscalendar.com/knowledgebase/running-a-saved-recurring-import-with-the-ical-importer/
See point 12.2
Is there a way to turn this off?
Thank you,
Carla / Lisianne
August 3, 2015 at 10:41 pm #992959Brook
ParticipantHowdy Carla,
It’s nice to meet you. I am happy you reached out. It’s an interesting conundrum you face. Probably the only time you will want to reimport something you have deleted is during testing, but that’s the phase you’re at and you understandable do wish to reimport.
You can turn that feature off. I wrote a quick snippet yo do just that. Paste it at the top of your theme’s functions.php file, underneath the first line “<?php”. If your theme does not have a functions.php file, go to your theme folder, create a new text document file called “functions.php”, and paste this text in the first line of the file “<?php”. On line 2 or 3, paste that snippet.
https://gist.github.com/elimn/13b32fb7763826df78d2
This will make any event you delete now truly delete. However, you still have some undeleted events in your database and they’re not showing up anywhere. With that snippet in place you can now properly delete them, but you will have to use some PHP. First we need to get a list of any iCal events that are hidden but not fully deleted. To do that run this SQL in your MySQL database:
SELECT ID FROM wp_posts WHERE post_type LIKE 'deleted_event'This will return a list of post IDs that you deleted. My database returned 857, 858, and a few others. To delete those I temporarily added these lines of code to my functions.php file:
wp_delete_post(857, true); wp_delete_post(858, true);That fully deleted those two posts. Now when I reran the iCal imported they reimported. But first, I had to remove the above two wp_delete_post lines from my functions file as those only needed to be run the one time. If you have access to your PHP console you can of course do this even easier, but not many have access so ignore this sentence if you don’t think you do.
Did you follow all of that? I am sorry it is not super easy to undo at this point. We did not really think about people in your shoes while building this who might be testing and actually wish to not permanently hide a given event. Please please let me know if you have any questions. I am here to help. 🙂
Cheers!
– Brook
August 4, 2015 at 9:05 am #993156Carla Dagnone
ParticipantHi Brook,
Thank you very much for your detailed response. Yes, I get it perfectly and I understand why it wa built that way.
You are correct: I am in development phase. I wanted to test the recurring sync. between Google and the Events Calendar and because I don’t manage the Google calendar of my client, I thought that deleting a few events was smart 🙂Thanks a lot for your support. Very much appreciated.
Lisianne / Carla
August 4, 2015 at 6:10 pm #993286Brook
ParticipantExcellent! I am happy to hear that worked.
– Brook
-
AuthorPosts
- The topic ‘iCal does not (re)import events which have been deleted by mistake in wordpress’ is closed to new replies.
