This is a very handy lightweight module and I was delighted to finally get it working (had neglected to enable filter).
It works as advertised, but I'd like to add a View fotonotes tab at node/% so that anyone viewing the original image node can immediately view the fotonotes that go with it. As is, the fotonotes have to be inserted in a node before anyone but the original editor can view them.
I've gone ahead and created the tab, but there are two problems.
First, not really knowing what I'm doing, I've just copied and pasted the function edit_fotonotes($node) code under a new function view_fotonotes($node). Combined with the permissions under the new $items['node/%node/viewfotonotes'] = array, this gives all users editing priviliges for any set of fotonotes.
Second, the path node/%node/viewfotonotes puts the tab in every node.
So . . .
1. How do I get fotonotes to display under the tab without the editing controls?
2. How do I get the tab to hide from nodes generated by other modules?
Here's the code for the tab, in case anyone's interested.
$items['node/%node/viewfotonotes'] = array(
'title' => 'View fotonotes',
'page callback' => 'view_fotonotes',
'page arguments' => array(1),
'access callback' => 'user_access',
'access arguments' => array('access fotonotes'),
'type' => MENU_LOCAL_TASK,
'weight' => '11',
);
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | viewfotonotestab.jpg | 186.16 KB | markpenny |
Comments
Comment #1
markpenny commentedHere's the code I'm using for function view_fotonotes($node)
Comment #2
markpenny commentedBy the way, the file I've been editing is fotonotes.module in the module root.
If you're a fellow novice and you decide to give the tab a try, remember to run update.php before checking whether it works, otherwise the necessary changes to menu_router in the database will not occur and there'll be nothing new to see on site.
Comment #3
markpenny commentedAnd here's what it looks like.
Comment #4
markpenny commentedHere's the code you need to get the effect I was after. Other users can view your notes under the tab, but there are no editing controls.
Comment #5
markpenny commentedSorry. I had the wrong access arguments for menu_router. Here's the correct code.
Comment #6
markpenny commentedClosing this and opening a new issue with resolution.