Please consider the following EntityFieldQuery. I would like to add a conditional parameter depending on the user's permissions. I'd expect the query would combine these statements and return both visibilities. However it ends in an empty result set. (Removing one of the statements gives the expected result).

$query = new EntityFieldQuery();
if(user_access('access public')) {
  $query->propertyCondition( 'visibility', 'public' );
if(user_access('access private')) {
  $query->propertyCondition( 'visibility', 'private' );

So how could I make both conditions apply without blocking each other?

  • I'm pretty sure you're asking the same question as the duplicate (how to OR two conditions in an EntityFieldQuery). If I've misunderstood please just ping me and I'll open it up again
    – Clive
    Dec 18, 2013 at 18:35
  • You are right, apologies. Dec 18, 2013 at 19:48


Browse other questions tagged or ask your own question.