« All Handlers

onFormatPublicSubmission

The onFormatPublicSubmission handler is called after a public submission has been received, validated with no errors, and is just about to be saved to your database. The $buffer field contains all of the fields that will go into the $_LW->create function, and this handler lets you filter them, add or remove arguments, etc. See below for an example module.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
$_LW->REGISTERED_APPS['my_app']=array(
'title'=>'My App',
'handlers'=>array('onFormatPublicSubmission'),
);

class LiveWhaleApplicationMyApp {

public function onFormatPublicSubmission($data_type, $buffer) {
global $_LW;
if ($data_type=='events') { // on before submission of an event
if (!empty($_LW->_POST['custom_tags'])) { // if custom tags were checked off, assign to event tags
if (is_array($_LW->_POST['custom_tags'])) {
$buffer['associated_data']['tags'] = $_LW->setFormatClean($_LW->_POST['global_tags']);
}
}
};
return $buffer;
}

}
?>