Created
April 28, 2020 15:01
-
-
Save Spellhammer/042129f07ea68c8c118d0618945230cd to your computer and use it in GitHub Desktop.
"Access" URL Param Condition for Oxygen
This file contains hidden or 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
if( function_exists('oxygen_vsb_register_condition') ) { | |
global $oxy_condition_operators; | |
// Condition to check if a URL parameter is present. | |
oxygen_vsb_register_condition('Access Code', array('options'=>array(), 'custom'=>true), $oxy_condition_operators['string'], 'oxy_access_code_callback', 'Other'); | |
function oxy_access_code_callback($value, $operator) { | |
if( $operator == '==') { | |
if( !empty( $_GET['access'] ) && $_GET['access'] == $value ) { | |
return true; | |
} else { | |
return false; | |
} | |
} else if( $operator == '!=' ) { | |
if( empty( $_GET['access'] ) || $_GET['access'] != $value ) { | |
return true; | |
} else { | |
return false; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment