Support

Home Forums Event Espresso Premium Programmatically "set meta"

Programmatically "set meta"

Posted: September 17, 2013 at 3:09 pm


High Touch Technologies

September 17, 2013 at 3:09 pm

Hello EE,

We have the ability to pull all of the meta values from an event with the event_espresso_get_event_meta function. Is there a way to add a value to an event programmatically if I have the event ID?

I know you can set defaults with custom functions, but I need the ability to set these values on the fly and I couldn’t find any mention of a ” event_espresso_set_event_meta”.

Thanks!


Dean

September 18, 2013 at 2:56 am

You could try

action_hook_espresso_update_event_meta
action_hook_espresso_save_attendee_meta

https://eventespresso.com/wiki/event-espresso-3-1-action-hooks/


High Touch Technologies

September 18, 2013 at 8:30 am

Hey Dean,

I don’t need an action hook. I was hoping for a quick method that allowed me to update/add an events meta value without having to hit the events detail table, unserialize the event_meta for that event, add my stuff to it and then reserialize and push back into the table.

Something like this:

<code>$meta = event_espresso_get_event_meta($event_id);
$meta[&#039;NEW_META_VALUE&#039;] = &#039;Whatever&#039;;
event_espresso_set_event_meta($event_id, $meta);</code>

or even:

event_espresso_set_event_meta($event_id, array('NEW_META_VALUE' => 'Whatever'));

Just a quick event that made it easy to dynamically add values to the event outside of EE.


Sidney Harrell

September 18, 2013 at 1:22 pm

No, we don’t have such a function built in. But you should be able to add one to your theme’s functions.php file, or to EE’s custom functions file.

The support post ‘Programmatically "set meta"’ 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