Share » Forums » Developer » Impossible to fetch users using...

Impossible to fetch users using subTreeByNodeID()

Impossible to fetch users using subTreeByNodeID()

Tuesday 16 June 2009 5:44:30 am - 4 replies

Modified on Wednesday 24 March 2010 1:15:48 am by Damien MARTIN

Author Message

Frédéric DAVID

Tuesday 16 June 2009 6:04:54 am

When you execute a cronjob , you are loggin in Anonymous. This user can't read the user section. To resolve your problem, you are two possibilities :

- You can use the parameter "Limitation" in the method subTreeByNodeID to avoid this problem
- You can logg in as an another user, like the admin User.

Blog : http://www.frefred.fr/blog/ez-publish
feZ Meta Data : http://projects.ez.no/fezmetadata

Damien MARTIN

Tuesday 16 June 2009 6:21:36 am

It looks like I'm tired...

On the other site I added a section limitation to access to the user list.
So the 'login step' was transparent for me...

It's logical and I'm asking to myself why I don't tried this before !

Thank you very much Frédéric

I feel like an idiot ^_^

OK : The probleme is solved

Heiner Wurbs

Thursday 11 February 2010 1:04:48 am

Before you fetch in yyour cronjob php file, do sth like this (instead of admin a cronjob user would be better, of course):

$user = eZUser::fetchByName('admin');
$userID = $user->attribute( 'contentobject_id' );
eZUser::setCurrentlyLoggedInUser( $user, $userID );

Now you can fetch the user objects in the User Tab:

$node =& eZContentObjectTreeNode::fetch( 5);

$nodes = $node->subTree( array ('ClassFilterType' => 'include', 'ClassFilterArray' => array ( 4 ))  );

Andy Caiger

Monday 28 June 2010 6:38:13 am

Is there a way to achieve this in template language alone? I'm trying to modify the standard notification behaviour by overriding the template in design/standard/templates/notification/handler/ezsubtree/view and need to fetch the siblings of the object being notified.

I don't really want to write PHP.

Is there a simple and secure way to run the standard notification cronjob with appropriate limitations?

EAB - Integrated Internet Success
Offices in England, France & China.
http://www.eab.co.uk http://www.eab-china.com http://www.eab-france.com

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu