I have node type called online_users. The node type has a field called field_website_id. I would like to get the nodes that has a specific field_website_id.
I have try to make the following action but gets an error:
function get_list_of_users($site_id) {
$query = new EntityFieldQuery();
$entities = $query->entityCondition('entity_type', 'node')
->propertyCondition('type', 'users_online')
->propertyCondition('field_website_id', $site_id)
->execute();
if (!empty($entities['node'])) {
$node = node_load(array_shift(array_keys($entities['node'])));
}
}
The error:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'node.field_website_id' in 'where clause': SELECT node.nid AS entity_id, node.vid AS revision_id, node.type AS bundle, :entity_type AS entity_type FROM {node} node WHERE (node.type = :db_condition_placeholder_0) AND (node.field_website_id IS NULL ) ; Array ( [:db_condition_placeholder_0] => users_online [:entity_type] => node ) in EntityFieldQuery->execute() (line 1140 of /Applications/MAMP/htdocs/Drupal/includes/entity.inc).
What is the right way to do this?