I have been working on a D6 version for Workspace module, and when I installed faq I got this error:

warning: Missing argument 3 for faq_access() in /home/hutch/www/tng.midwales.whs/drupal-6.3/sites/all/modules/faq/faq.module on line 43.

I traced through the Workspace code which calls node_access, not faq_access directly, so I had a look at node access Drupal 6.3. The comments above node_access clearly state that $accounts is optional:

......
 * @param $account
 *   Optional, a user object representing the user for whom the operation is to
 *   be performed. Determines access for a user other than the current user.
 * @return
 *   TRUE if the operation may be performed.
 */
function node_access($op, $node, $account = NULL) {
  global $user;
......
  // If no user object is supplied, the access check is for the current user.
  if (empty($account)) {
    $account = $user;
  }

There is something similar in user_access

I have attached a patch for faq.module based on the above code

I would be most interested to hear your opinion of this issue, I can see that this way of dealing with $account makes for greater flexibility

Comments

hutch’s picture

StatusFileSize
new966 bytes

Ooops I forgot some bits in the patch, this one is right

stella’s picture

Category: bug » task
Status: Active » Fixed

Committed, thanks.

However, I'm not sure this can be called a bug report since the docs on hook_access() don't declare the $account param as being optional.

Cheers,
Stella

hutch’s picture

Thanks for such a quick response, I agree that task better describes this issue.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

stella’s picture

Released in 6.x-1.8.