[email protected]
Forum Replies Created
-
Well i am glad i could at least gig something small back. Big smile on my face for not being stupid.
Thanks again
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.
I am the worst person to ask! I am a total novice at this. I simply used the code Marcus put above and listed all of the details i had, ie the start and end date, title etc.
$EM_Event = new EM_Event(); $EM_Event->event_name = 'your event'; //etc. $EM_Event->save();
Exactly as above! You dont need to worry about where the information needs to go in the database, the $Em_Event->Save() does all of that for you. As Marcus said, you must have a minimum of the event name, start and end date for the event to create. The problem i encountered was that it didn’t create a few of the values for the post_meta (as they were created in a different function of the events manager) so i had to populate a few more variables, namely $start and $end.
$EM_Event->start = strtotime($EM_Event->event_start_date." ".$EM_Event->event_start_time); $EM_Event->end = strtotime($EM_Event->event_end_date." ".$EM_Event->event_end_time);
That probably shows me up for knowing nothing about this stuff, but it worked. I hope that makes some kind of sense. If not hopefully Marcus will be able to guide you.
No worries, i either sorted it or made a work around. Thanks!
I have identified the problem, its not saving the end_ts and start_ts properties correctly in the postmeta. not sure why or who i am meant to fix it.
I bet this is sooo simple!
so i am doing well, the instructions you gave were exactly what i needed. The events adds to the db, but in the admin events page the event isnt listed? The annoying thing is i only have two events listed and it says 3 are published. Also, when i manually found the edit event page for the added event (by changing the url to use the post id on the event) it found it perfectly, with all of the information listed, and when i clicked update, without changing anything, the event was then listed in the events admin page.
It must be something simple. Any ideas?
thats exactly what i meant. incredible, thank you. I will drop you a link when its done and launched.
I should say i got some help ??
Amazing, thats exactly what i needed! i was hoping it could be done that simply. Do i need to define every field or will the ones that need to be null etc already be filled? (does that make any sense!)
Thank you so much for putting up with my ignorance. To boost myself up a bit, i know nothing about programming yet i have made a plugin that gathers geolocation information, searches events and grabs information from last.fm
I am pretty pleased with myself.
I cant wait to get this bit done.
Thanks again
Hi Marcus, Thanks for the reply. I have a friend helping me out who knows a bit more about it, so i will show him your reply and hopefully he can help me implement this.
To clarify, the bit that i am trying to create at the moment will create an event using information that i have got from other sources. I have all of the required information waiting to be saved to the database and its using a pre existing location so that bits not too bad either. i understand how to manually store the information into the post, meta and events table, but i was just trying to search for a cleaner way of doing this, ie using the EM_Event->Save().
Thanks again for your help. I will be writing a bit on our blog about the plugin and your support when we are up and running.
Thank you for the speedy response. This is quite a similar idea to what i am trying to create, but i am only trying to create a single event at a time.
Also, this doesn’t seem to use the events manager save function, what are the advantages / disadvantages of doing it manually / using the save function?
Thank you once again, its so great that people take the time to help others out, especially when i am such a novice.