Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Sample LiveWhale event creation code
// Sample event creation code
require $_SERVER['DOCUMENT_ROOT'].'/livewhale/nocache.php'; // load LW functions
$gid = 1; // id of group where the event should be created
$data_to_save = array( // create sample event
'title'=>'Sample Event',
'status'=>2, // 1 = live, 2 = hidden
'date'=>$_LW->toDate('m/d/Y', $_LW->toTS('+1 month')), //start date
'date2'=>'', // end date
'date_time'=>'', // start time (leave blank for all day)
'date2_time'=>'', // end time
'is_all_day'=>1, // set to 1 for all day
'categories'=>array(1,2,3), // array of event type IDs
'caption'=>'Photo of a whale.',
if ($id=$_LW->create('events', $data_to_save)) {
echo 'Created event '.$id.'<br/>';
else {
echo $_LW->error.'<br/>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment