How to get the values ​of an array in the options list (hook_rules_condition_info ()) instead of array index? 'example_condition_user' =&gt; array(
      'label' =&gt; t('User Condition'),
      'arguments' =&gt; array(
      ),
      'parameter' =&gt; array(
        'username' =&gt; array(
          'type'  =&gt; 'text',
          'options list' =&gt; 'list_all_users', 
          'label' =&gt; t('Username'),
          'description' =&gt; t('user that the conditions apply'),
         ),
        'user_entry' =&gt; array(
          'type'  =&gt; 'user',
          'label' =&gt; t('user'),
        )
      ),
      'group' =&gt; t('exemplo'),
      'module' =&gt; 'exemplo',
)


function list_all_users(){

  $query = db_select('users', 'u');
  $query-&gt;fields('u', array('name'));

  $result = $query-&gt;execute()-&gt;fetchAll();
  $ret = array();


  foreach($result as $r){
    array_push($ret, $r-&gt;name);
  }


  return array_values($ret);

}


The list_all_users function returns the users (that are in my database) in a array, but the options list does not get the values ​​of the array, but the array index, and this is a problem, because I need the values ​​of the index, and then do the validations rule_condition_info (), does anyone have any idea how to fix this?
You just need a reliable array key so you can load the data up again somewhere else; since you're going into the users table, uid seems appropriate:

function list_all_users() {
  return db_query('SELECT uid, name FROM {users}')-&gt;fetchAllKeyed();
}


That will turn the options into an array with user IDs as keys and names as values. As far as the front end is concerned, nothing changes.

Now when you receive the selected option value in the validation function, you can just load the user up and get the name from the entity:

$account = user_load($the_value);
$name = $account-&gt;name;