Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #6 from diegotdai/master

Fixes issues for custom roles
  • Loading branch information...
commit 4569e6c7236357ea6c939d66300bb4d11bb0f477 2 parents 1a8cc9d + dede797
Lewis Carey authored
Showing with 5 additions and 6 deletions.
  1. +5 −6 users_field.php
View
11 users_field.php
@@ -84,7 +84,7 @@ function create_options($key, $field)
{
// only translate the output not the value
- $choices[$details['name']] = translate_user_role( $details['name'] );
+ $choices[$role] = translate_user_role( $details['name'] );
}
@@ -172,7 +172,7 @@ function pre_save_field($field)
function create_field($field)
{
-
+ $editable_roles = get_editable_roles();
$field['role'] = isset($field['role']) ? $field['role'] : false;
$field['multiple'] = isset($field['multiple']) ? $field['multiple'] : false;
@@ -181,15 +181,13 @@ function create_field($field)
if(!$field['role'] || !is_array($field['role']) || $field['role'][0] == "")
{
- $editable_roles = get_editable_roles();
-
$field['role'] = array();
foreach ( $editable_roles as $role => $details )
{
if ($details['name'] != "")
{
- $field['role'][] = $details['name'] ;
+ $field['role'][] = $role ;
}
}
}
@@ -215,6 +213,7 @@ function create_field($field)
foreach($field['role'] as $role)
{
+ $label = $editable_roles[$role]['name'];
// get users
$args = array(
'role' => $role
@@ -226,7 +225,7 @@ function create_field($field)
if($users)
{
- echo '<optgroup label="'.translate_user_role($role).'">';
+ echo '<optgroup label="'.translate_user_role($label).'">';
foreach($users as $k => $user)
{
Please sign in to comment.
Something went wrong with that request. Please try again.