WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] $EM_Location->save() : Update Issue (3 posts)

  1. rar_jds
    Member
    Posted 9 months ago #

    I'm trying to use $EM_Location->save() to update location data through an interface I'm writing. When the source system has different values than current EM Location, I want to update the EM Location.

    It works great when the address, name, or country code change ... I can load $EM_Location with the new values plus updates to other items like state, postal code, and attributes, saves fine.

    However, it seems that if only the custom attributes change, the save() function is not updating the data. Same if only state, postal code change ... the function does not update.

    Once there is an update to the address, name, or country code field ... everything updates correctly. So it seems that the function is only evaluating the fields in $EM_Location->required_fields for processing updates.

    I've looked through the code and cannot find why/where it is doing this check (a little above my skill level at this point).

    Is this correct and desired functionality? If so, is there something I can pass that will trigger the update? Or will I just need to write my own function to do the update?

    Any help/advice is greatly appreciated.
    Thanks

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

  2. angelo
    NetWebLogic Support
    Posted 8 months ago #

    have you tried $EM_Location->save_meta() or hook into em_location_save_meta filter instead?

  3. rar_jds
    Member
    Posted 8 months ago #

    Perfect!!

    I called save_meta after Save and it worked perfect.

    $EM_Location->save();
    $EM_Location->save_meta();

    Thanks angelo_nwl

Reply

You must log in to post.

About this Plugin

About this Topic

Tags