Integration with Gravity Forms?
  • Power User
    Posts: 52
    Topics: 10
    Answers: 1
    Christina October 13, 2011

    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: 12
    Shane Pearlman October 13, 2011

    Hey Christina,

    I’ll ask Tim or John to update it.

  • Power User
    Posts: 43
    Topics: 13
    Andrew October 14, 2011

    +1 for this please :)

  • Truth Seeker
    Posts: 20

    Answers: 4
    John October 15, 2011

    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.

  • Power User
    Posts: 52
    Topics: 10
    Answers: 1
    Christina October 17, 2011

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

  • Truth Seeker
    Posts: 20

    Answers: 4
    John October 18, 2011

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

  • Power User
    Posts: 52
    Topics: 10
    Answers: 1
    Christina October 18, 2011

    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: 4202
    Topics: 81
    Answers: 467
    Rob October 18, 2011

    Thanks 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: 12
    Shane Pearlman October 26, 2011

    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.

  • Gatekeeper
    Posts: 4202
    Topics: 81
    Answers: 467
    Rob October 26, 2011

    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.

  • Gatekeeper
    Posts: 4202
    Topics: 81
    Answers: 467
    Rob October 26, 2011

    Or, 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: 31
    Topics: 7
    Answers: 1
    Brian October 26, 2011

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

  • Truth Seeker
    Posts: 31
    Topics: 7
    Answers: 1
    Brian October 26, 2011

    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

  • Truth Seeker
    Posts: 31
    Topics: 7
    Answers: 1
    Brian October 27, 2011

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

  • Truth Seeker
    Posts: 31
    Topics: 7
    Answers: 1
    Brian October 27, 2011

    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.

  • Power User
    Posts: 52
    Topics: 10
    Answers: 1
    Christina October 27, 2011

    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: 31
    Topics: 7
    Answers: 1
    Brian October 27, 2011

    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…

  • Truth Seeker
    Posts: 31
    Topics: 7
    Answers: 1
    Brian October 27, 2011

    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

  • Gatekeeper
    Posts: 4202
    Topics: 81
    Answers: 467
    Rob October 27, 2011

    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.

  • Gatekeeper
    Posts: 4202
    Topics: 81
    Answers: 467
    Rob October 27, 2011

    Oh, 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.

  • Power User
    Posts: 52
    Topics: 10
    Answers: 1
    Christina October 27, 2011

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

  • Truth Seeker
    Posts: 20

    Answers: 4
    John October 27, 2011

    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']);

  • Power User
    Posts: 52
    Topics: 10
    Answers: 1
    Christina October 27, 2011

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

  • Gatekeeper
    Posts: 4202
    Topics: 81
    Answers: 467
    Rob October 28, 2011

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

  • Power User
    Posts: 52
    Topics: 10
    Answers: 1
    Christina October 29, 2011

    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!

  • Stranger
    Posts: 1
    Topics: 1
    Miguel October 31, 2011

    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.

  • Gatekeeper
    Posts: 4202
    Topics: 81
    Answers: 467
    Rob October 31, 2011

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

  • Stranger
    Posts: 16

    Al November 2, 2011

    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

    Al November 2, 2011

    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:

    http://bit.ly/uFAZHN

    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

  • Truth Seeker
    Posts: 16
    Topics: 9
    Jamie November 4, 2011

    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?

  • Viewing 30 posts - 1 through 30 (of 65 total)

This topic is closed