Forums / Developer / Container users??

Container users??

Author Message

luis muñoz

Sunday 17 June 2007 7:09:56 am

Hi,

I modified user class to be container. Then created a new content class which will live under the user. Then i created content with no problems.

The problem starts when i try to recover that nodes under the user. Using code like

{def $usuario=fetch('user','current_user')}
{def $nodes_list=fetch('content','list',hash('parent_node_id', $usuario.contentobject.main_node_id))}

doesn´t work. Returns an empty array. But if i manually fetch one of the nodes under $usuario with something like

{def $nodes_list=fetch('content','list',hash('parent_node_id', 113))}

It returns the node with no problems.

Also tried the code from the admin siteacces (copy / paste) with the same results.

Is this a bug? Is there any way to fetch all nodes under a user??

Thanks

André R.

Sunday 17 June 2007 1:26:18 pm

what is $usuario.contentobject.main_node_id if you output it ?

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

luis muñoz

Monday 18 June 2007 12:15:15 am

Hi,

$usuario.contentobject.main_node_id is the actual user node_id. I fetched user in the line before :

{def $usuario=fetch('user','current_user')}

Because $usuario.node_id is not definided and the only thing i found with the same value was $usuario.contentobject.main_node_id.

Thanks

Luis

luis muñoz

Monday 18 June 2007 9:22:18 am

Hi,

I'm stuck about this. Any idea about how to fetch content under the user? is this a bug? a feature?

Any help would be appreciated

Luis Muñoz

Joe Kepley

Monday 18 June 2007 8:03:01 pm

Your $usario variable contains a User object, which is a different from the user's content object.

$usario.contentobject.main_node_id is the correct variable to call for the main_node_id.

If this fetch isn't returning anything, there are a couple of things to check:

* Check the anonymous role (or whatever role you're using) to ensure that you can read the content objects

* Check the role assignment to ensure that it's not limited to say, media and content.

Łukasz Serwatka

Monday 18 June 2007 11:55:01 pm

It is also good idea to enable debug output with SQL output, you can see what is wrong there.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog