Home › Forums › Calendar Products › Event Aggregator › Apply event categories after FB event import
- This topic has 7 replies, 2 voices, and was last updated 10 years, 7 months ago by
Brian.
-
AuthorPosts
-
August 23, 2015 at 2:17 am #998245
Jacob
ParticipantHello team!
I’d like to know if it is technically possible to apply my event categories to imported fb events? I am not referring to importing categories form fb, I know that’s not possible due to the FB api.
The Tribe import setting should allow to define one or many categories for each FB page ID so that after each event import that category is applied.
Can I do this with php hooks?
Best wishes,
JacobAugust 24, 2015 at 9:06 am #998454Brian
MemberHi Jacob,
Thanks for using our plugins. I can help out.
Currently, there is no hooks in the plugin to do this and the WordPress hooks for saving a post run to early to be able to target the Facebook Events Only.
I did find a hook that runs when a custom field is added. So I created a hook to run and if the meta field equals facebook-importer it will add an event category.
This hook though runs everytime a custom field is created so it is not ideal, but seems to be working correctly for manual and auto imports.
https://gist.github.com/jesseeproductions/bba4f0e18bbef5171531
Replace the 20 with the event category you would like to set it too.
Let me know how that works out.
Thanks
August 24, 2015 at 5:54 pm #998638Jacob
ParticipantHello Brian,
Oha, that is very interesting. I will check it out. What kind of actions technically count as the creation of a custom field? I have just little coding expertise yet. Hope the question doesnt sound too stupid 🙂
After pasting the code into my functions.php, does it run automatically after each automatic fb event import?
Yours
JacobAugust 25, 2015 at 7:37 am #998782Brian
MemberHi Jacob,
It should run on an automatic fb event import.
I tested on my site and it worked for me.
If you create a new custom field for a post it should hook to that.
If you update an existing custom field it should not run.
Also, if it finds an event category it will not add a default one. It is looking for a specific field in the imported facebook events so it should not add a category to any other events either.
Cheers
August 26, 2015 at 12:36 pm #999301Jacob
ParticipantHello Brian,
I am testing it now. I get no category applied when i use the manual fb event import by event ID. Do you have a hint?
Would it be custom work to modify the code so that I get a result like:
FB page A -> category #1 is applied to the events imported
FB page B -> category #2 is applied to the events imported
FB page C -> category #3 is applied to the events imported
and
FB page D -> category #1 is applied to the events importedOr is this a fast forward code modification you can give me?
Best wishes,
JacobAugust 26, 2015 at 12:57 pm #999309Brian
MemberSorry it was working for me I would check your Event Category ID, but beyond that I cannot troubleshoot a customization.
And it is not possible to use the coding I provided to give a category based on a Facebook Page as that information is not saved with the event it just saves the Events Facebook ID.
Unfortunately, that is all I have for this and the only other method to get this would be to modify the Facebook Plugin Directly.
August 28, 2015 at 1:24 am #999813Jacob
ParticipantHey Brian,
Thank you for your assistance. I will check out the user voice area if that feature is present and vote for it.
Best wishes,
JacobAugust 28, 2015 at 7:26 am #999884Brian
MemberSorry I could not help more.
Please upvote the feature though so we can push to get it in the plugin.
I am going to close this ticket, but if you need anything else related to this topic or another please post a new topic on the forum and we can help you out.
Thanks
-
AuthorPosts
- The topic ‘Apply event categories after FB event import’ is closed to new replies.
