Skip to content

Instantly share code, notes, and snippets.

View karlhinze's full-sized avatar

Karl Hinze karlhinze

View GitHub Profile
karlhinze / private.application.global_search.php
Last active February 10, 2017 16:08
A custom module for LiveWhale: easy global searches by ID
$_LW->REGISTERED_APPS['global_search']=array( // configure this module
'title'=>'Global Search',
class LiveWhaleApplicationGlobalSearch {
public function onLoad() { // in back-end search, if admin searching for ID, automatically search globally
karlhinze / public.application.server_path.php
Last active April 19, 2017 14:30
LiveWhale custom module to save the current URL segments as XPHP variables
// Provide access to each segment of the server path with the variable: <xphp var="url_segment_[x]" />
'title'=>'Server Path',
class LiveWhaleApplicationServerPath {
karlhinze / private.application.custom_fields.php
Last active December 19, 2017 20:09
This new-and-improved LiveWhale module uses five handlers to get and set a custom field on an existing LiveWhale datatype.
This is a sample application designed to demonstrate how to add an additional custom field to a backend editor.
The example provided adds a "Dress Code" field to the existing event editor in LiveWhale. To add a custom field to the news editor, for example, follow the same example but change all references from events to news below.
$_LW->REGISTERED_APPS['custom_fields'] = array( // configure this application module
'title' => 'Custom Fields',
'handlers' => array('onLoad', 'onAfterValidate', 'onSaveSuccess', 'onAfterEdit', 'onOutput')
class LiveWhaleApplicationCustomFields {
karlhinze / myscript.php
Created November 27, 2017 15:40
Example private LiveWhale script
// Load LiveWhale
require $_SERVER['DOCUMENT_ROOT'].'/livewhale/nocache.php';
// Show errors
ini_set('display_errors', 1);
// Require logged-in user
if (!$_LW->isLiveWhaleUser()) {
karlhinze / public.application.my_module.php
Created November 27, 2017 15:48
Example LiveWhale module
// Save this file in /livewhale/client/modules/mymodule/ and login to LiveWhale to load the module for the first time.
'title'=>'My Module',
class LiveWhaleApplicationMyModule {
karlhinze / sample_create_event.php
Last active April 15, 2020 18:45
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
// JS functionality for a redundant checkbox above the group suggest selector box, providing a checkbox for users to select to a specific chosen group (like the homepage or main communications team).
(function($, LW) {
// Make adjustments below to match the group id and group name
// to the calendar group you want to use for this feature.
var group_id = '8';
var group_name = 'Homepage';
if ( === 'events_edit' || === 'events_sub_edit' || === 'news_edit') { // define pages to target with this transformation
if (livewhale.group_title != group_name) { // if we're not in the target group