Support Forums

Integration with Gravity Forms?

  • Posts: 52 Topics: 10 Answers: 1
    | Permalink

    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?

    Posts: 83 Topics: 2 Answers: 12
    | Permalink

    Hey Christina,

    I’ll ask Tim or John to update it.

    Posts: 43 Topics: 13
    | Permalink

    +1 for this please :)

    Posts: 20 Answers: 4
    | Permalink

    The date and time stuff should still work, but the post type has changed between ECP 1.3 and ECP 2.0, so you may need to rebuild the form using the new custom post type. If that doesn’t work, then let me know.

    Posts: 52 Topics: 10 Answers: 1
    | Permalink

    Shouldn’t the custom post type still be “Events”, or is it something else?

    Posts: 20 Answers: 4
    | Permalink

    Yes, it is, but internally the post type name has changed which is why I think that redoing the form should hopefully fix it.

    Posts: 52 Topics: 10 Answers: 1
    | Permalink

    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 :-)

    Posts: 4251 Topics: 91 Answers: 467
    | Permalink

    Thanks for confirming, Christina. John is going to take another look at this and should be in touch here shortly.

    Posts: 83 Topics: 2 Answers: 12
    | Permalink

    Hey 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.

    Posts: 4251 Topics: 91 Answers: 467
    | Permalink

    Hi 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.

    Posts: 4251 Topics: 91 Answers: 467
    | Permalink

    Or, for those interested in seeing it in a more structured format: https://theeventscalendar.com/event-submissions-using-gravity-forms-in-2-0/.

    Posts: 31 Topics: 7 Answers: 1
    | Permalink

    Awesome, thanks for this Rob. Attempting to do this integration with GFORMS right now

    Posts: 31 Topics: 7 Answers: 1
    | Permalink

    Got 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

    Posts: 31 Topics: 7 Answers: 1
    | Permalink

    Here 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);
    }
    }
    }

    Posts: 31 Topics: 7 Answers: 1
    | Permalink

    Form 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.

    Posts: 52 Topics: 10 Answers: 1
    | Permalink

    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

    Posts: 31 Topics: 7 Answers: 1
    | Permalink

    Thanks for the link Christina, I’m going to try that. Looks like it should work, it simply maps the venue fields that aren’t mapped in the code from the original tut. I’ll let you know how I get on, and will post full code if I get it working…

    Posts: 31 Topics: 7 Answers: 1
    | Permalink

    No luck, tried everything I could think of…. I don’t expect we’ll receive support on this issue either as the “community events” add-on is coming out sometime…and it’s basically going to do the same thing we are trying to do with gforms

    Posts: 4251 Topics: 91 Answers: 467
    | Permalink

    Thanks 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.

    Posts: 4251 Topics: 91 Answers: 467
    | Permalink

    Oh, also – the code is a bit clearer here: https://theeventscalendar.com/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.

    Posts: 52 Topics: 10 Answers: 1
    | Permalink

    Rob, the code you posted on both pages have the same syntax errors. Brian’s code is correct.

    Posts: 20 Answers: 4
    | Permalink

    Hi 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’]);

    Posts: 52 Topics: 10 Answers: 1
    | Permalink

    Trying it now. Organizer is working but I’m getting “Unnamed Venue” in place of the actual venue.

    Posts: 4251 Topics: 91 Answers: 467
    | Permalink

    What is your venue name custom field called? Is it _EventVenue or _VenueVenue? You should be using the latter.

    Posts: 52 Topics: 10 Answers: 1
    | Permalink

    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!

    Posts: 1 Topics: 1
    | Permalink

    Excuse me but my english is bad

    I have gravity forms license but i thought that with community events was not necessary gravity forms.

    Can someone tell me what is the diference becuase im a bit lost.

    Posts: 4251 Topics: 91 Answers: 467
    | Permalink

    Christina, 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 :)

    Posts: 16 Topics: 9
    | Permalink

    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?

    Posts: 16 Topics: 9
    | Permalink

    The first half of that might be a lot easier than that now….
    The Gravity Forms + Custom Post Types add-on (http://themergency.com/plugins/gravity-forms-custom-post-types/) offers ability to put both taxonomy or post type entries into standard drop-down fields.

    Still can’t seem to make it quite work, but that might help the process for someone else.

    Posts: 16 Topics: 9
    | Permalink

    The recent updates to GF 1.6 and the Custom Post Type plugin for GF has made this integration quite easy for the first scenario.

    Create a standard drop-down with dynamic population parameter name ‘EventVenueID’ and specify Populate with a Post Type of ‘Venues’. Setting the default entry to something like ‘–select venue–‘.

The topic ‘Integration with Gravity Forms?’ is closed to new replies.