In a volume path, the one tokens that seem to replace are the User tokens; Node tokens, such as [node;nid] do not replace. I am using elFinder in a panel and the panel does have the node id as I can use it on the panel as a title for example (%node). In elFinder, if I put the path in as "lovelyFiles/[node:nid]", the directory that gets created in the path is literally called "[node:nid]". I tried with "lovelyFiles/[user:uid]" and that correctly creates a directory named with the current user.

Is there a trick to getting the node replacement tokens to work?

Comments

Cookie.Monster’s picture

An update, I put some debugging into elfinder.module and this line does not return anything from the node_load function

$node = node_load($user->uid);
Cookie.Monster’s picture

Digging into it more and node_load needs to take a node id, not a uid. I am trying to find out how to get the current node and I've followed a few suggestions such as:

$node = node_load(arg(1));

$node = menu_get_object();

but both are empty. I don't know enough about loading nodes into modules to know if I'm on the right track. I'll keep digging though but would appreciate some help. Without this, I can't use elFinder. :(

Cookie.Monster’s picture

I got it working for my situation. I had to replace

line 1049:
$node = node_load($user->uid);

with:

if (module_exists('og_context') AND isset($_SESSION['og_context']['gid'])) {
     $gid =  $_SESSION['og_context']['gid'];
     node = node_load($gid);
} 

I can't say this solution will work for everyone as I need it in particular for use with OG. And having the ability to use it with OG is a very useful feature I think.

I do believe that sending the user UID in the noad_load in line 1049 as an argument though is not correct? So, I'm still leaving this a bug so the maintainer can take a look and see what he/she thinks.

ph0enix’s picture

Title: Token replacement for [node] not working. » [patch] Token replacement for [node] not working.
Assigned: Unassigned » ph0enix
Priority: Normal » Major
Issue summary: View changes
Status: Active » Needs review

ph0enix’s picture

Status: Needs review » Closed (fixed)

Thank You for the patch!