I don&#39;t think you are using the &#39;page arguments&#39; 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&#39; 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">&lt;<a href="mailto:davide@ser-tec.org">davide@ser-tec.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello, i&#39;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&#39;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&#39;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(&#39;access role A files&#39;, &#39;access role B files&#39;);<br>
}<br>
<br>
/**<br>
 * Implementation of hook_menu().<br>
 */<br>
<br>
function custom_private_download_name_menu() {<br>
  $items = array();<br>
<br>
  $items[&#39;system/files/kb/role/a/%&#39;] = array(<br>
    &#39;access arguments&#39; =&gt; array(&#39;access role A files&#39;),<br>
    &#39;type&#39; =&gt;  MENU_CALLBACK,<br>
    &#39;page callback&#39; =&gt; &#39;file_download&#39;,<br>
    &#39;page arguments&#39; =&gt; array(&#39;kb/role/a&#39;),<br>
  );<br>
<br>
  $items[&#39;system/files/kb/role/b/%&#39;] = array(<br>
    &#39;access arguments&#39; =&gt; array(&#39;access role B files&#39;),<br>
    &#39;type&#39; =&gt;  MENU_CALLBACK,<br>
    &#39;page callback&#39; =&gt; &#39;file_download&#39;,<br>
    &#39;page arguments&#39; =&gt; array(&#39;kb/role/b&#39;),<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>
    &#39;Content-Type: &#39;. file_get_mimetype($filepath),<br>
    &#39;Content-Length: &#39;. filesize(file_create_path($filepath)),<br>
    &#39;Content-Disposition: attachment; filename=&quot;&#39;.<br>
mime_header_encode(basename($filepath)) .&#39;&quot;&#39;<br>
  );<br>
  // additional user-defined file header attributes (if any)<br>
  return array_merge($header, explode(&quot;\n&quot;,<br>
variable_get(&#39;private_download_header&#39;, &quot;Content-Transfer-Encoding:<br>
binary\nCache-Control: max-age=60, must-revalidate&quot;)));<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>