Skip to content

Instantly share code, notes, and snippets.

@lianglee
Created August 11, 2021 05:54
Show Gist options
  • Save lianglee/512d1f6bcc81d8806615c10573e46221 to your computer and use it in GitHub Desktop.
Save lianglee/512d1f6bcc81d8806615c10573e46221 to your computer and use it in GitHub Desktop.
Custom administrator page URL
<?php
function add_custom_any_existing_handler_page_inot(){
if(ossn_isAdminLoggedin()){
ossn_add_hook('page', 'load', 'add_custom_any_existing_handler_page');
ossn_add_hook('page', 'override:view', 'add_custom_any_existing_handler_override');
}
}
function add_custom_any_existing_handler_override($hook, $type, $return, $params){
if(isset($params['handler']) && !empty($params['handler']) && $params['handler'] == 'administrator' && $params['page'][0] == 'custompage'){
return true;
}
return false;
}
function add_custom_any_existing_handler_page($hook, $type, $return, $params){
if(isset($params['handler']) && !empty($params['handler']) && $params['handler'] == 'administrator' && $params['page'][0] == 'custompage'){
$id = $params['page'][0];
echo 'new stuff';
}
}
ossn_register_callback('ossn', 'init', 'add_custom_any_existing_handler_page_inot');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment