I don't think you are using the 'page arguments' parameter correctly. Check out the documentation on hook_menu <a href="http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_menu/6">http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_menu/6</a> or peruse other modules' implementations.<div>
<br></div><div>I would also suggest that your effort be posted as an issue to the Private Download issue queue and you post a patch such that you may contribute to the existing body of work. <a href="http://drupal.org/project/issues/search/private_download">http://drupal.org/project/issues/search/private_download</a><br>
<br><div class="gmail_quote">On Fri, Apr 29, 2011 at 3:15 AM, Davide Mirtillo <span dir="ltr"><<a href="mailto:davide@ser-tec.org">davide@ser-tec.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello, i'm trying to develop a module similar to private_download, but<br>
with multiple directories:<br>
<br>
<a href="http://drupal.org/project/private_download" target="_blank">http://drupal.org/project/private_download</a><br>
<br>
The module has been written based on this post:<br>
<br>
<a href="http://www.drupalcoder.com/blog/mixing-private-and-public-downloads-in-drupal-6" target="_blank">http://www.drupalcoder.com/blog/mixing-private-and-public-downloads-in-drupal-6</a><br>
<br>
I managed to create the hook_menu implementation, but i am running into<br>
issues with the access callback function.<br>
<br>
My drupal install seems to completely skip the access argument check and<br>
i can't figure out why, since the same access arguments variable present<br>
in the hook_menu implementation in the original module is working<br>
flawlessly.<br>
<br>
I'd really like some ideas on why the files are downloadable by everyone<br>
and the permission check does not have any effect.<br>
<br>
This is the code of my custom module:<br>
<br>
/**<br>
* Implementation of hook_perm().<br>
*/<br>
<br>
function custom_private_download_perm() {<br>
return array('access role A files', 'access role B files');<br>
}<br>
<br>
/**<br>
* Implementation of hook_menu().<br>
*/<br>
<br>
function custom_private_download_name_menu() {<br>
$items = array();<br>
<br>
$items['system/files/kb/role/a/%'] = array(<br>
'access arguments' => array('access role A files'),<br>
'type' => MENU_CALLBACK,<br>
'page callback' => 'file_download',<br>
'page arguments' => array('kb/role/a'),<br>
);<br>
<br>
$items['system/files/kb/role/b/%'] = array(<br>
'access arguments' => array('access role B files'),<br>
'type' => MENU_CALLBACK,<br>
'page callback' => 'file_download',<br>
'page arguments' => array('kb/role/b'),<br>
);<br>
return $items;<br>
}<br>
<br>
/**<br>
* Implementation of hook_file_download().<br>
*/<br>
<br>
function custom_private_download_file_download($filepath) {<br>
// define default file header attributes<br>
$header = array(<br>
'Content-Type: '. file_get_mimetype($filepath),<br>
'Content-Length: '. filesize(file_create_path($filepath)),<br>
'Content-Disposition: attachment; filename="'.<br>
mime_header_encode(basename($filepath)) .'"'<br>
);<br>
// additional user-defined file header attributes (if any)<br>
return array_merge($header, explode("\n",<br>
variable_get('private_download_header', "Content-Transfer-Encoding:<br>
binary\nCache-Control: max-age=60, must-revalidate")));<br>
}<br>
<font color="#888888">--<br>
[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br>
</font></blockquote></div><br></div>