• Resolved onirgoc

    (@onirgoc)


    Hello,

    EM unfortunatly do not have forms conditionnal field; so I am trying to use Gravity and populate field dynamicly.

    It’s working fine for Event Name field with this:

    // Populate gravity forms Event Name Field with Event Name
    
    add_filter('gform_field_value_event_name', 'populate_event_name');
    
    function populate_event_name($value){
    	global $EM_Event;
    
    $event_name_EM = $EM_Event->output('#_EVENTNAME');
    
        return $event_name_EM;
    }

    where “event_name” is the parameter to put in the gravity option : allow dynamic…etc…

    For event date it looks like much more difficult and until now I can’t make it work with “event_date” as gravity field value :

    add_filter('gform_field_value_event_date', 'populate_event_date');
    
    function populate_event_date($value){
    	global $EM_Event;
    
    $event = em_get_event($post->ID, 'post_id');
    $start_date_EM = $event->event_start_date;
    $start_date_EM = str_replace('-', '/', $start_date_EM);
    
        return strtotime($start_date_EM);
    }

    Any help ?

    By the way special message to EM devlopper: why don’t you offer user the choice to use either gravity, woocommerce or your solution for forms and payement ? It could make your pro version a “must have”.

    https://wordpress.org/plugins/events-manager/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    integration with gravity forms are already been request in the pro forums however no eta yet since there other features which needs to be done first.

    Thread Starter onirgoc

    (@onirgoc)

    Angelo : In good french your answer is like : “botter en touche” 😉 …and doesn’t help. Thanks anyway for that good plugin.

    Thread Starter onirgoc

    (@onirgoc)

    To test I created an event for the 30/08/2014

    $event = em_get_event($post->ID, 'post_id');
    $start_date_EM = $event->event_start_date; // 2014-08-30
    $dt = date_create_from_format('Y-m-d', $start_date_EM);
    echo date_format($dt,'d/m/Y');

    return the good value ( 30/08/2014 ) when testing directly on a single page…

    but applying this on functions.php (twentyfourteen theme) :

    add_filter('gform_field_value_event_date', 'populate_event_date');
    
    function populate_event_date($value){
    
    $event = em_get_event($post->ID, 'post_id');
    $start_date_EM = $event->event_start_date; // something like 2014-08-30
    $dt = date_create_from_format('Y-m-d', $start_date_EM);
    return date_format($dt,'d/m/Y');
    }

    returns

    Warning: date_format() expects parameter 1 to be DateTime, boolean given in

    I will find the solution but some help is really welcome !

    Thread Starter onirgoc

    (@onirgoc)

    Hello !

    it was so simple ! thanks to gravity support :

    add_filter('gform_field_value_event_date', 'populate_event_date');
    function populate_event_date($value){
    	global $EM_Event;
    	global $post;
    
    	$event = em_get_event($post->ID, 'post_id');
    	$start_date_EM = $event->event_start_date;
    	$start_date_EM = str_replace('-', '/', $start_date_EM);
    	$start_date_EM = date("d/m/Y", strtotime($start_date_EM));
    	return $start_date_EM;
    }

    next…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Event Date and dynamyc field with gravity form’ is closed to new replies.