Posted by v1nce on July 30, 2008 at 9:01pm
Jump to:
| Project: | Node clone |
| Version: | 5.x-2.5 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Modules that wish to extend clone access with the clone_access_alter hook are not implemented due to the $access variable not being updated. The attached patch fixes this issue.
| Attachment | Size |
|---|---|
| clone_access-patch.txt | 464 bytes |
Comments
#1
The function signature for _alter hooks is that the first param is passed by reference. Did you implement your hook as such?
#2
Yes, but your code is not updating the $access variable within the clone_access() function. See the node.module example code:
<?phpforeach (module_implements('nodeapi') as $name) {
$function = $name .'_nodeapi';
$result = $function($node, $op, $a3, $a4);
?>
$result variable is updated with the return value from hook_nodeapi.
#3
This is an _alter hook like hook_form_alter - there is not expected to be a return value. You need to declare the first parameter as passed by reference.
compare function clone_access($node):
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/node_clone/...
with:
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/node_clone/...
where I use the 6.x drupal_alter() API function.
#4
Understood. Thank you.