View Full Version : Please help: Adding events programatically
Joshva
11-14-2007, 08:55 AM
I am trying to add events programaticaly from my custom CMS.
I have added the following 2 events
event id 178 was added via my CMS and does NOT show up in the vbulletin calendar.
event id 179 was added via vbulletin and does show up in the vbulletin calendar.
details....
178 1 <strong>The Chemical Brothers</strong><p><br/>
<im... The Chemical Brothers 1 0 1 a:0:{} 1 1195034917 0 1204887600 0 0
179 1 test Chemical bros 1 0 1 a:0:{} 1 1195036164 0 1204848000 0 0
Why does event id 179 no appear in the calendar?
Is their a cache i need to refresh?
Thanks,
Josh
Analogpoint
11-14-2007, 01:35 PM
Copy the 'add event' code in calendar.php starting on line 1613, and it should work.
Joshva
11-14-2007, 08:42 PM
Awesome. Will do tonight
Joshva
11-17-2007, 11:48 PM
OK I now have been able to add events and they are appearing at the bottom of the forums:
http://www.joshandfriends.com.au/forums/
BUT the events aren't appearing in the Calendar:
http://www.joshandfriends.com.au/forums/calendar.php
I only have 1 calendar by the way and the events are definately being linked to that calendar.
Any ideas?
Joshva
11-19-2007, 10:22 PM
Does anyone know what might be the problem??
Thanks
--------------- Added 1195540217 at 1195540217 ---------------
A good example is here:
http://www.joshandfriends.com.au/forums/calendar.php?do=getinfo&day=2007-11-23&e=160&c=1
I click on that link and can see the event. When I click on the date 23rd of November in the breadcrump it shows no events. Even though it is there.
Analogpoint
11-20-2007, 01:01 PM
Post the code that you're using to add events.
Joshva
11-20-2007, 10:05 PM
The following is java code but it should be fairly simple to read.
long currentDateLine = Calendar.getInstance().getTimeInMillis() / 1000;
long eventDateLine = (event.getDateTime().getTime()) / 1000;
forumEvent.setTitle(event.getTitle());
forumEvent.setDescription(description);
forumEvent.setCreatedBy(event.getCreatedBy());
forumEvent.setDateline(currentDateLine);
forumEvent.setFromDate(eventDateLine);
forumEvent.setCustomFields(CUSTOM_FIELDS);
forumEvent.setCalendarId(systemConfiguration.getVB ulletinCalendarId());
event.setForumEvent(forumEvent);
The event object is then saved via a hibernate an the above row is inserted in the vbulletin_event table.
Please let me know if I am missing anything.
Thanks,
Josh
Joshva
11-26-2007, 04:00 AM
Any further thoughts on this? What else am i missing?
Analogpoint
11-26-2007, 01:29 PM
As long as you're doing everything in the 'add event' code in calendar.php, it should work fine.
Joshva
11-27-2007, 07:03 AM
The problem is i don't know php so i don't know what i'm missing
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.