Created
March 24, 2017 18:37
-
-
Save solepixel/6c7d65230ca88332415598875c925605 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Imported from Post Types Order deprecated code. | |
* https://github.com/alessandropellegrini/post-types-order/blob/master/include/functions.php | |
*/ | |
if( ! function_exists( 'userdata_get_user_level' ) ){ | |
function userdata_get_user_level( $return_as_numeric = FALSE ){ | |
global $userdata; | |
$user_level = ''; | |
for ( $i=10; $i >= 0;$i-- ){ | |
if ( current_user_can('level_' . $i) === TRUE ){ | |
$user_level = $i; | |
if ( $return_as_numeric === FALSE ) | |
$user_level = 'level_'.$i; | |
break; | |
} | |
} | |
return ( $user_level ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment