Skip to content

Instantly share code, notes, and snippets.

@karlhinze
Created November 27, 2017 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karlhinze/9645255ead5ad81bdfc33e91ca3f3b32 to your computer and use it in GitHub Desktop.
Save karlhinze/9645255ead5ad81bdfc33e91ca3f3b32 to your computer and use it in GitHub Desktop.
Example LiveWhale module
<?php
// Save this file in /livewhale/client/modules/mymodule/ and login to LiveWhale to load the module for the first time.
$_LW->REGISTERED_APPS['my_module']=array(
'title'=>'My Module',
'handlers'=>array('onFormsSubmission'),
);
class LiveWhaleApplicationMyModule {
public function onFormsSubmission($id) {
global $_LW;
if ($id == 123) { // Replace this with the ID number for your LiveWhale form
// Pull values from fields, checking the form's HTML to get the field names
$field1 = strip_tags($_LW->_POST['lw_form_123_1234567890']);
$field2 = strip_tags($_LW->_POST['lw_form_123_1234567891']);
// etc.
// Put the rest of your script here, including any create() or update() actions based on your form.
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment