drupal 7 - EntityFieldQuery throws an error while using fieldCondition and addTag('node_access') -
i use drupal 7. code:
$query = new entityfieldquery(); $resfirstname = $query->entitycondition('entity_type', 'node') ->entitycondition('bundle', 'user') ->fieldcondition('field_user_first_name', 'value', $str, 'rlike') ->range(0, 15) ->addtag('node_access') ->execute();
when site's user isn't admin throws following error: "pdoexception: sqlstate[42s22]: column not found: 1054 unknown column 'field_data_field_user_first_name0.nid' in 'where clause': select field_data_field_user_first_name0.entity_type entity_type, ..." if remove ->fieldcondition('field_user_first_name', 'value', $str, 'rlike')
or ->addtag('node_access')
- no error.
thanks
i had similar case. able solve modifying fieldcondition
while retaining other conditions , parameters:
->fieldcondition('field_user', 'first_name', $str, 'rlike')
Comments
Post a Comment