Background import tasks handled by cron may run as anonymous user. Sometimes, the anonymous user is not allowed to query entities e.g when you use content access and restrict view to administrator role. In this case EFQ Finder won't return any result.
The solution is to run query as user allowed view to content. This patch adds field to choose which user to run the query with.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mouhammed’s picture

twistor’s picture

Status: Needs review » Needs work
+++ b/plugins/efq_finder.inc
@@ -118,7 +129,7 @@ function feeds_tamper_efq_finder_form($importer, $element_key, array $settings,
-  $column = _feeds_tamper_efq_finder_get_value('column', $form_state, $settings);
+  $column = _feeds_tamper_efq_finder_get_value('columns', $form_state, $settings);

Why this change?

Can you give me an example of a query that is failing?

mouhammed’s picture

FileSize
17.83 KB
13.01 KB
40.12 KB
23.05 KB

Example :

We have to content type : Enterprise (Name) and Employe (Name, Enterprise). Every employe has an entity reference field to reference his enterprise.
Employe content type
Employe content type

Enterprise content type
Enterprise content type

Content access is enabled on Enterprise with this configuration :
Enterprise access control
Enterprise access control

We have create feeds to import all employe and set the entity reference field with the EFQ plugin.
EFQ Config

When you run import from UI, all references are filled correctly but from cron, the query doesn't works. Because cron may run with anonymous user wich is not allowed to view content of type Enterprise.

mouhammed’s picture

I removed accidental change on

<?php
$column = _feeds_tamper_efq_finder_get_value('column', $form_state, $settings);
?>
mouhammed’s picture

Avoid loading the user object twice.