Closed (fixed)
Project:
Docs
Version:
5.x-1.0-alpha3
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
30 May 2008 at 07:58 UTC
Updated:
13 Jun 2008 at 08:02 UTC
Hi.
I recently found this bug.
On using upload module with docs,if we attach file to a group,the file doesn't get attached at all.
In group,only the file information is displayed.
The download link does not appear because the file does not get attached at all.
The problem is with docs_node_information().There while trying to do $f = array_shift($node->files); it removes the array that contains the file information.
original code:
function docs_node_information( $node ) {
if( is_array($node->files) && !empty($node->files)) {
$f = array_shift($node->files);
$href = file_create_url( $f->filepath );
$output = l($f->filename, $href, array('class'=>'docs-file-icon', 'title'=> $node->title) );
}
return $output;
}
My fix
function docs_node_information( $node ) {
if( is_array($node->files) && !empty($node->files)) {
//$f = array_shift($node->files);
//instead of doing array_shift,i get the array from node->files which contains all information
$f = $node->files;
$href = file_create_url( $f->filepath );
$output = l($f->filename, $href, array('class'=>'docs-file-icon', 'title'=> $node->title) );
}
return $output;
}
Just to inform that this function is used by docs_nodeapi hook when $op = "view".it uses to assign property to node.
Thanks
Comments
Comment #1
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.