• Resolved [email protected]

    (@neiloliverphotogmailcom)


    First let me start off by saying i love events manager. I am seriously blown away by the features and support, even on the free version.

    I am a bit of an amateur at all fo this so please forgive me if i misunderstand things or use the incorrect terminology.

    I am trying to add an event via PHP in a plugin that i am building. I know from searching the forums that i need to use EM_event->save() and that i need to build an events object, but i have no clue how i build this object.

    If someone could help me out that would be great, just showing me how i would build the object and how i call the EM_Events->Save from another php file.

    if you assume that i would be entering each of the values needed (ie Event Title) as a text value then i should be able to work out how to substitute that with the information i already have.

    Thank you so much in advance.

    https://www.ads-software.com/extend/plugins/events-manager/

Viewing 4 replies - 16 through 19 (of 19 total)
  • Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    ah, start/end aren’t populated first time round. However, they should be next time the object is loaded from the DB.

    I thought you meant _start_ts/_end_ts which is stored as post meta in the wp_postmeta table.

    Thread Starter [email protected]

    (@neiloliverphotogmailcom)

    No i did mean the start_ts and end_ts weren’t being stored properly, but isnt the value that gets stored just the $start and $end variables? regardless, thats how i got it to work and i am now pushing the limitations of my knowledge and im quickly going to get lost! Thank you once again for all of your help.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    ??

    thanks for disagreeing, I looked again and actually, you have a point here…

    $EM_Event->start/end are used to save _start_ts/_end_ts but since they aren’t defined until you load a saved post (or save using get_post), it won’t work here, so you’ve actually caught me out here, you DO need to save those two values!

    e.g.

    $EM_Event->start = strtotime($EM_Event->event_start_date.' '.$EM_Event->event_start_time);
    $EM_Event->start = strtotime($EM_Event->event_end_date.' '.$EM_Event->event_end_time);
    Thread Starter [email protected]

    (@neiloliverphotogmailcom)

    Well i am glad i could at least gig something small back. Big smile on my face for not being stupid.

    Thanks again

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘building an events object’ is closed to new replies.