Exemple #1
0
/**
 * Sort the given roles by number of capabilities
 *
 * @param array $roles
 *
 * @return array
 */
function authLdap_sort_roles_by_capabilities($roles)
{
    global $wpdb;
    $myRoles = get_option($wpdb->get_blog_prefix() . 'user_roles');
    authLdap_debug(print_r($roles, true));
    uasort($myRoles, 'authLdap_sortByCapabilitycount');
    $return = array();
    foreach ($myRoles as $key => $role) {
        if (isset($roles[$key])) {
            $return[$key] = $roles[$key];
        }
    }
    authLdap_debug(print_r($return, true));
    return $return;
}
Exemple #2
0
/**
 * Get an individual option
 */
function authLdap_get_option($optionname)
{
    $options = authLdap_load_options();
    if (isset($options[$optionname])) {
        return $options[$optionname];
    } else {
        authLdap_debug('option name invalid: ' . $optionname);
        return null;
    }
}