Posting event with a gravity form.
WordPress Event Management, Calendars & Registration › Forums › General Question › Posting event with a gravity form.
This topic contains 30 replies, has 5 voices, and was last updated by Stephen Harris 10 years, 9 months ago.
-
AuthorPosts
-
January 12, 2013 at 7:57 pm #2954
Mmm… odd. Feel free to pastebin with your updated code.
eo_update_event()
should work – its used to update the events from the admin side :). What is returned? Should be the post ID – but it could be anWP_Error
.Stephen Harris
January 13, 2013 at 5:38 am #2959Looking at the example at gravity here, it uses
wp_update_post()
so I can not see whyeo_update_event()
will not work. I don’t get any error the post is created but with out the event_details.
Also if I create two of these posts with the pastebin code the second post does not show up in the events list (admin side) until I trash the first. Which is odd.If I let eo and gravity make a post each the gravity post is a lower number (ie 402) then the eo post (ie 404) so I know I have a post id.
I can use
eo_insert_event()
and disable gravity from making the post and update all the post meta but then I lose the uploaded image being moved to the media library (re sized, set as featured) and this works well for me as I can easily remove attachments when events are deleted.Thank you for your time!
Michael
January 13, 2013 at 8:33 pm #2964Looking at your gist, looks like you have the arguments of
eo_update_event()
swapped. (Post ID first), but then the$event_data
should be the second, and the$post_data
should be third.Also, you update the title, content and status – that might not be necessary if Gravity Forms have already created the post (doesn’t harm to leave it in though).
Stephen Harris
January 13, 2013 at 9:43 pm #2965No go.
I will try that code (a few posts back) to see if I can attach an image when usingeo_insert_post()
.Michael
February 6, 2013 at 5:22 pm #3319If you use Brad Vincent’s Gravity Forms + Custom Post Types plugin (http://themergency.com/plugins/gravity-forms-custom-post-types/) you can use GF’s Post title field to save as a custom post type. Then all you need to do is create custom fields (Date and Time) to fill in the post meta. What are the unique identifiers for the post meta in the meta box Event Details?
Start Date/Time:
End Date/Time:
All day (Checked/unchecked):
Reoccurence:
Include/Exclude occurrences:
Venue:Thanks! (:
Matt
February 6, 2013 at 11:35 pm #3323Hi Matt,
I think all you need to use is
eo_update_event()
with the arguments there to save the event schedule meta and save the dates to the database.Stephen Harris
February 7, 2013 at 1:21 pm #3334If you wanted to create a separate function in a child theme, I believe you are correct to use
eo_update_event
. For the amateurs and non-coders, gravity has this built in custom post type field to insert the values into your custom event post type (See Image). What would be the unique meta keys for each field?iphoenix
February 7, 2013 at 1:42 pm #3335Unfortunately it’s not that simple. The post meta simply contains scheduling meta data – but this is serialised -and in any case, the dates would still need to be generated and saved to the database table.
However, I’ve been considering building an EO-Gravity Forms add-on that would make this easier. But, until then, the only way of doing it is to use
eo_update_event()
using the post ID passed to you from Gravity Forms.Stephen Harris
February 8, 2013 at 2:31 am #3344With the code I pasted in this post before I have no problems using gravity to submit events. BUT only using
eo_insert_event()
and using Gravity Form hook to disable it from creating the post. If I useeo_update_event()
things do not work right. Like the dates are not added and if I post a second event it will not show up in the post list until I delete the first. But they do not show up on the front end as they have not date meta.I am even having luck setting up events that are not all day events (reoccurring).
My only problem/wish is that I could get a featured image to work. I can not work out how to get the uploaded image into wp media when gravity does not make the post. If i try to use the image from gravity upload path it has a bunch of stuff at the end of the extention I’m unsure about ( ie: xyz.jpg|:|:| ).
So it is not very hard to do but an add on would be cool to.
Michael
February 23, 2013 at 2:00 am #3596Stephen please help me with this bit. I can set up all but weekly event recurrences.
I have my weekly data (MO,TU etc) stored in
$entry['43']
from check boxes on my GF. How do I set an array from the values in this variable to send to$schedulemeta
?$schedulemeta = $entry['43'] ;
I will add my full code after I get this bit done with hopes you’ll look it over for me and to share with others.
Michael
February 23, 2013 at 3:37 am #3597After digging in the database to see how my
$entry['43']
data is stored I see I have this$entry['43.1']
,$entry['43.2']
etc for each of the values. So now I can add the data to the array but I get this “SASU” not “SA”,”SU”. I don’t know (yet) how to format the array right. Also How would I get something like this$entry['43.$s']
do deal with the [43.X] for my 7 days (is there a wildcard for the .X)?Michael
February 23, 2013 at 5:37 am #3598Ok worked it out. May not be pretty but…Thanks for letting me thing out loud.
Michael
April 15, 2013 at 11:37 am #5555Hi Stephen,
In which folder in wordpress I need to add your script from your site?Thank you so much for answer.
Matej
April 15, 2013 at 11:47 am #5556Ok nevermind, I figured that out, but I have one more question – event is posted as a draft is here any way how to post it right to the web?
Matej
May 19, 2014 at 8:11 pm #10882Hi Stephen
I am a big fan of your awesome plugin. It would be absolutely brilliant to offer fronted event posting with the functionality of gravity forms plugin. You wrote about an gravity form add-on a while ago? Are there any news?
Thanks a lot for your info, Ben
Benjamin Ogg
-
AuthorPosts