Skip to content

Instantly share code, notes, and snippets.

@solepixel
Created March 24, 2017 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save solepixel/6c7d65230ca88332415598875c925605 to your computer and use it in GitHub Desktop.
Save solepixel/6c7d65230ca88332415598875c925605 to your computer and use it in GitHub Desktop.
<?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