Last active
February 10, 2017 16:08
-
-
Save karlhinze/12ea065d42aca8007792f1857f62b582 to your computer and use it in GitHub Desktop.
A custom module for LiveWhale: easy global searches by ID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$_LW->REGISTERED_APPS['global_search']=array( // configure this module | |
'title'=>'Global Search', | |
'handlers'=>array('onLoad') | |
); | |
class LiveWhaleApplicationGlobalSearch { | |
public function onLoad() { // in back-end search, if admin searching for ID, automatically search globally | |
global $_LW; | |
if ($_LW->page=='search') { | |
if (!empty($_LW->_GET) && array_key_exists('search',$_LW->_GET)) { | |
if ($_LW->userSetting('core_admin')) { | |
if (preg_match('~^[0-9]+$~', $_LW->_GET['search'])) { | |
$_LW->_GET['group_mode'] = 1; // show from all groups | |
$_LW->_GET['results'][] = 2; // search shared content | |
$_LW->_GET['results'][] = 5; // show non-hidden content | |
} | |
} | |
} | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment