Drupal 7 get user by Profile2 field value I have Profile2 field name uid_intranet which is unique. 
And in one of my module, I want to get $user object by uid_intranet. The API is kinda like: 

$users = profile2_get_users('uid_intranet', 100)


But no such API. So any solutions?

Thanks!

UPDATE 01, my complete code:

// Helper
function _mymodule_get_profiles_by_profile2field($field_name, $field_value) {
  $table = "field_data_{$field_name}";
  $column = "{$field_name}_value";

  // Profile IDs
  $pids = db_select($table, 'ui')
    -&gt;fields('ui', array('entity_id'))
    -&gt;condition($column, $field_value, '=')
    -&gt;execute()
    -&gt;fetchAllKeyed(0,0);
  if (is_array($pids) &amp;&amp; count($pids) &gt; 0) {
    $profiles = profile2_load_multiple($pids);
  }
  return $profiles;
}
Why not adding your helper function to query the database, something like below

function mydmoulename_get_user_by_prfoile2field($field_value) {
    $user = new stdClass();
    $user_id = db_select('field_data_field_uid_intranet', 'ui')
        -&gt;fields('ui', array('entity_id'))
        -&gt;condition('field_uid_intranet_value', $field_value, '=')
        -&gt;execute()
        -&gt;fetchAllKeyed(0,0);
    if (is_array($user_id) &amp;&amp; count($user_id) &gt; 0) {
        $user = user_load_multiple($user_id);
    }
    return $user;
}


NOTE:

When you add a field to profile, a custom table is created in database,so check your database and get the table name, in above example I am using table name as "field_data_field_uid_intranet". When you browse the table you will find column where it wil be storing the field value against the user who added the fied, you need to check the column name which is holding the field value in above exampe I am using "field_uid_intranet_value" as column name change it according to your requirement.

Once done, now you have your own function simply call it passing the field value as argument like

$user = mymodulename_get_user_by_prfoile2field(100);


you will get the complete user object as return value.