This is not currently possible, but thank you for your feedback and suggestion!
Can you explain your use case in more detail? Then it will be easier for me to see how I can implement this in a flexible way 🙂
https://github.com/intoxstudio/restrict-user-access/blob/master/api/level.php
I would like to retrieve the access levels of the current user. I have created my own plugin/addon to collect the current user ID with the intention to use it in combination with your API.
I have been trying to use the level.php file, specificly the one function below:
/**
* API to get user levels
*
* @since 0.9
* @param int $user_id
* @param boolean $hierarchical
* @param boolean $synced_roles
* @param boolean $include_expired
* @return array
*/
function rua_get_user_levels(
$user_id = null,
$hierarchical = true,
$synced_roles = true,
$include_expired = false) {
return RUA_App::instance()->level_manager->get_user_levels($user_id,$hierarchical,$synced_roles,$include_expired);
}
For some odd reason, it returns the text “array” not actually an array of user access levels.
I am calling the function with the following line, am I doing something wrong?:
$current_user_levels = rua_get_user_levels($current_user_id);
Kind Regards,
I was being stupid, I found out how to do it! For all the newbie scripters out there like me:
add_action(‘init’, ‘rua_get_user_levels_custom’);
function rua_get_user_levels_custom($user_id){
$user_id = get_current_user_id();
$user_levels = rua_get_user_levels($user_id);
echo implode(“,”, $user_levels );
}