I have a field within the user's profile set with their payroll. What I'm trying to achieve within my module is find the uid, based on the value of a payroll field.
I've tried a few things, but I can't get it to work. What I'm currently trying is this, but it returns unknown field of user
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'user')
->fieldCondition('user', 'field_user_payroll', $payroll, '=');
$result = $query->execute();
$account = user_load($result);
$wrapper = entity_metadata_wrapper('user', $account);
$mimemail = $wrapper->mimemail->raw();
watchdog('Photo Import', "Mimemail: %mimemail",
array('%mimemail' => $mimemail), WATCHDOG_INFO);
Any help would be really appreciated. It's driving me crazy!
EntityFieldQuery
? Your code is quite far off from what it should be, that's all