-
Power User
Posts: 49
Topics: 9
I know you are working furiously on the new community events option, but since I can’t wait, I’d like to use Gravity forms to allow for event submission. Tom Bowen’s excellent tutorial no longer seems to work because it appears that the way he referenced date and time have changed. Any hints or clues on how to patch it back together?
-
Power User
Posts: 83
Topics: 2
Answers: 12Hey Christina,
I’ll ask Tim or John to update it.
-
Power User
Posts: 49
Topics: 9
I rebuilt from scratch and it isn’t working for me. I’m getting the title and description correctly. When I test the form it is being correctly added as a draft in the “Events” category. But none of the other data (date, time, venue…) is persisting.
I’ll be the first to admit I’m no programming genius, so if anyone on the support forum gets this working, I’d love to know about it. I need this functionality to work for a site that is going live in the next two weeks.
Or maybe, just maybe, I’ll get super lucky and the Community Events Plugin will be ready within two weeks
-
Gatekeeper
Posts: 3563
Topics: 62
Answers: 393Thanks for confirming, Christina. John is going to take another look at this and should be in touch here shortly.
-
Power User
Posts: 83
Topics: 2
Answers: 12Hey Christina,
John poked at it today and noticed that the issue had to do with some new security measures we put in based upon the recommendations of the core team. John said he could update the tutorial to provide a new approach and is working on it. We’ll let you know as soon as he has a working solution.
-
Gatekeeper
Posts: 3563
Topics: 62
Answers: 393Hi folks. It looks I spoke with John about this today and it looks like you can get Tim’s original tutorial working by adding this code to the functions.php file:
add_action(‘save_post’, ‘save_tec_event_meta_from_gravity’, 11, 2);
function save_tec_event_meta_from_gravity($postId, $post) {
if( class_exists(‘TribeEvents’) ) {
// only continue if it’s an event post
if ( $post->post_type != TribeEvents::POSTTYPE || defined(‘DOING_AJAX’) ) {
return;
}
// don’t do anything on autosave or auto-draft either or massupdates
if ( wp_is_post_autosave( $postId ) || $post->post_status ‘auto-draft’ || isset($_GET['bulk_edit']) || $_REQUEST['action'] ‘inline-save’ ) {
return;
}
if( class_exists(‘TribeEventsAPI’) ) {
TribeEventsAPI::saveEventMeta($postId, $_POST, $post);
}
}
}If anyone has any problems with this or find it non-functional (we tested today and it worked without issue), please let me know.
-
Gatekeeper
Posts: 3563
Topics: 62
Answers: 393Or, for those interested in seeing it in a more structured format: http://tri.be/event-submissions-using-gravity-forms-in-2-0/.
-
Truth Seeker
Posts: 25
Topics: 5
Answers: 1Got an error,
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in functions.php on line 149
There’s a problem somewhere in this line:
if ( wp_is_post_autosave( $postId ) || $post->post_status ‘auto-draft’ || isset($_GET['bulk_edit'])
Any idea? Is there a typo in there somewhere
-
Truth Seeker
Posts: 25
Topics: 5
Answers: 1Here is the correct code (did you really try test this?! haha – two equals signs were missing, could not have worked, crashes site)
add_action(‘save_post’, ‘save_tec_event_meta_from_gravity’, 11, 2);
function save_tec_event_meta_from_gravity($postId, $post) {
if( class_exists(‘TribeEvents’) ) {
// only continue if it’s an event post
if ( $post->post_type != TribeEvents::POSTTYPE || defined(‘DOING_AJAX’) ) {
return;
}
// don’t do anything on autosave or auto-draft either or massupdates
if ( wp_is_post_autosave( $postId ) || $post->post_status == ‘auto-draft’ || isset($_GET['bulk_edit']) || $_REQUEST['action'] == ‘inline-save’ ) {
return;
}
if( class_exists(‘TribeEventsAPI’) ) {
TribeEventsAPI::saveEventMeta($postId, $_POST, $post);
}
}
} -
Truth Seeker
Posts: 25
Topics: 5
Answers: 1Form is working, event post is created when I submit the form….and title, body, start time and end time are being saved…..but Venue details are not. I have fields like “Venue Name”, “Venue Address”, “Venue City”, and “Venue Zip Code”.
Using _EventVenue as the custom field name , _EventCity and so on…isn’t working , and the data isn’t being saved along with the other event data. It is submitting to the form though in Gforms.
Any ideas?
I’m using the code from this tut http://creativeslice.com/tutorials/gravity-forms-events-calendar-submissions/ along with the code I pasted above in my functions.php file.
-
Power User
Posts: 49
Topics: 9
I’m in the same state as Brian. Venues aren’t persisting.
Brian, have you seen this post: http://support.makedesignnotwar.com/discussion/comment/5379/#Comment_5379
It settled the venue issue in an older version. Maybe a tweak would fix it for ECP 2
-
Truth Seeker
Posts: 25
Topics: 5
Answers: 1 -
Truth Seeker
Posts: 25
Topics: 5
Answers: 1 -
Gatekeeper
Posts: 3563
Topics: 62
Answers: 393Thanks guys. I’m going to get John, the developer who wrote this update & tested/confirmed this as functional, to chime in. I just handle support/QA and am not a developer – so this one is a bit outside my area of expertise. I’ve sent this his way.
-
Gatekeeper
Posts: 3563
Topics: 62
Answers: 393Oh, also – the code is a bit clearer here: http://tri.be/event-submissions-using-gravity-forms-in-2-0/. I doubt you manually rewrote it based on my first note, but if you did, try that code instead.
-
Truth Seeker
Posts: 20
Answers: 4Hi guys,
I apologize for the syntax error – our issue tracker stripped out the 2 equal signs when I copy/pasted. To save venue and organizer try to add the following lines above the saveEventMeta line.
$_POST['Organizer'] = stripslashes_deep($_POST['organizer']);
$_POST['Venue'] = stripslashes_deep($_POST['venue']);if( !empty($_POST['Venue']['VenueID']) )
$_POST['Venue'] = array(‘VenueID’ => $_POST['Venue']['VenueID']);if( !empty($_POST['Organizer']['OrganizerID']) )
$_POST['Organizer'] = array(‘OrganizerID’ => $_POST['Organizer']['OrganizerID']); -
Gatekeeper
Posts: 3563
Topics: 62
Answers: 393What is your venue name custom field called? Is it _EventVenue or _VenueVenue? You should be using the latter.
-
Power User
Posts: 49
Topics: 9
I am oh so very close with this. Everything is persisting except the Venue name. It is coming in as “Unnamed Venue”, but strangely, the permalink correctly shows the venue name. I’ve made a screencast of my code and what I’m seeing.
http://www.screencast.com/t/HL7pfe5M2Jv
I really appreciate this! I’ve already bought the three pack of ECP, I will almost certainly be upgrading to the 10 pack. Once the community event plugin is available I will be first in line to purchase it and support your development efforts. Thank you!
-
Gatekeeper
Posts: 3563
Topics: 62
Answers: 393Christina, just a heads up that John is still looking into this one – should be able to get you a response very shortly here. Thanks for being patient
-
Stranger
Posts: 16
Hey Rob,
Soo I have followed all of the directions on the Gravity Forms tutorial and get everything up until the “paste into functions.php”. Is there a specific place I need to plug this in?
This is what my functions.php looks like: http://bit.ly/uFAZHN
The file I am editing is “functions.php” edited through the drop down menu under Appearance in the WordPress dashboard sidebar, which traces to my theme folder and functions.php file, so everything is good from what I gather.
When I try to update it, it brings the whole site down, and just shows a blank white screen. Everything fails to load and I have to overwrite the functions.php file with the original via FTP.
I’m not a developer really, but I think it’s pretty straight forward. I just am missing something. What am I missing here?
-
Stranger
Posts: 16
Hey guys,
Soo I’m stuck. I don’t think I know exactly where to put the added code in the functions.php. Here is a copy of my functions.php:
When I try to update my functions.php, the site goes white and stops working entirely. I then have to overwrite the functions.php with the original file via FTP.
I’m not a web developer really, but I think the tutorial is pretty straight forward. What am I doing wrong?
Cheers,
Jeromie
-
Stranger
Posts: 8
Topics: 3
Went looking into the DB to see what I could see.
-Venues are stored as a custom post type (tribe_venue)
-Venue details are stored as post meta (custom fields) on tribe_venue
-Venue ID is post meta (custom field) on event post type (tribe_events)
-Similar approach for Organizer (tribe_organizer)Seeing this approach makes me more inclined to wait for the community events add-on, but if I were to take a stab at implementing something specific to GF with TEC 2.0 I might:
-Use a standard drop-down field for Venue ID
-Populate it with hook on gform_validation that pulls all posts with type tribe_venue storing the ID as value and name (post title) in display
-Augment the save_tec_event_meta_from_gravity function Brian wrote to get it into $_POST format expected.My immediate use cases for GF / TEC integration don’t go farther than that, but if you wanted to add a drop-down option to ‘add new venue’ via the front-end:
-During save event with add new venue selected….
-Create a post (venue) with the venue info as post meta data and retrieve the post ID
-Store that as the venue ID in place of the drop-down value for ‘Add New Venue’ option before letting the function described above occur.I just finished doing a rideshare board plugin that used GF for front-end submission (http://wordpress.org/extend/plugins/idealien-rideshare/) with custom post type + taxonomies for the data storage which was comparable, but much easier by being able to just do wp_insert_term for any new elements.
Out of curiosity – did extending terms (something like http://wordpress.org/extend/plugins/taxonomy-metadata/) ever come up as a potential vector rather than venue / organizer being post types?
Integration with Gravity Forms?
