Skip to content

Instantly share code, notes, and snippets.

@msonnabaum
Created March 22, 2011 17:07
Show Gist options
  • Save msonnabaum/881595 to your computer and use it in GitHub Desktop.
Save msonnabaum/881595 to your computer and use it in GitHub Desktop.
<?php
/**
* Implementation of hook_views_query_substitutions().
*/
function welcom_core_views_query_substitutions($view) {
$roles = user_roles();
$subs = array();
foreach ($roles as $rid => $role) {
$subs['***ROLE_' . strtoupper(str_replace(array('-',' '), '_', $role)) . '***'] = $rid;
}
return $subs;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment