Support

Home Forums Event Espresso Premium EE4 – Front form with ACF

EE4 – Front form with ACF

Posted: January 20, 2016 at 2:32 pm


JacquesMivi

January 20, 2016 at 2:32 pm

Hello,

I am creating a front form with ACF pro. Right now I’m looking to associate a evt_venue_id with correct event meta information, but I don’t find the correct name or line to do it. I try this, but it’s not working :

// Add the value venue
add_post_meta( $post_id, 'evt_venue_id', $_POST['acf']['field_569b7988a2e49'] );

Is it the good way ?
Have you the corect name of “evt_venue_id” ?
Have you a list of correct name to associate to the event evt_ticket ? evt_ticket_satus ? evt_people ? etc.

My aim is to create a complet front end form for external users. If you are interested I will share my final code on github.


Josh

  • Support Staff

January 21, 2016 at 11:31 am

If I understand your question, you’ll find the data you’re looking for in the _esp_event_venue table, which you may need to do a JOIN on that table to get the Event’s venue ID if you’re not using the built in model queries. The same idea would apply to the other pieces of data you’re looking to get.


JacquesMivi

January 24, 2016 at 12:00 pm

Thanks for your help. I’m progressing.
I have another problem. I want to associate people with event. It’s almost working :

function _insert_new_people_to_event($new_event_id,$new_people_id,$new_people_type){
global $wpdb;
$cols_n_values = array(
‘PER_ID’=>$new_people_id,
‘OBJ_ID’=>$new_event_id,
‘OBJ_type’=> ‘Event’,
‘P2P_Order’ => 0,
‘PT_ID’=>$new_people_type);

$datatypes = array(
‘%d’,//PER_ID
‘%d’,//OBJ_ID
‘%d’,//OBJ_type
‘%d’,//P2P_Order
‘%d’//PT_ID
);

$success = $wpdb->insert($wpdb->prefix.”esp_people_to_post”,$cols_n_values,$datatypes);
return $wpdb->insert_id;
}

In my database “OBJ_type” remains empty (Others fields are ok). I don’t know what kind of value I have to inject (I try ‘Event’, ‘Events’, ‘espresso_events’).

Do you have an idea ?


Tony

  • Support Staff

January 25, 2016 at 3:06 am

Its because your using

'OBJ_type'=> 'Event',

Which is a string, but within your datatypes your using a placeholder for integer:

'%d',//OBJ_type

Change that to:

'%s',//OBJ_type


JacquesMivi

January 25, 2016 at 7:47 am

Perfect.
Thanks a lot.

The support post ‘EE4 – Front form with ACF’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso