Skip to content

Instantly share code, notes, and snippets.

@alexfinnarn
Last active August 23, 2018 22:31
Show Gist options
  • Save alexfinnarn/a666dcb49358b27347e59ce5170d8b8d to your computer and use it in GitHub Desktop.
Save alexfinnarn/a666dcb49358b27347e59ce5170d8b8d to your computer and use it in GitHub Desktop.
getting all roles
<?php
function user_roles($members_only = FALSE, $permission = NULL, $full_objects = FALSE) {
$user_roles = &backdrop_static(__FUNCTION__);
if (!isset($user_roles)) {
$user_roles = array();
// @todo: Consider a cache get here instead of reading from disk.
$names = config_get_names_with_prefix('user.role.');
//....more code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment