Add a hook to mailhandler, to be invoked after node save
acecombat - June 30, 2009 - 12:08
| Project: | Mailhandler |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
I looked through the documentation and tried a few things myself but couldn't work out how to have a new page create a menu link when creating a new page.

#1
Hai,
follow this steps:
1.first create a page and save the page.it will be saved with a node number say (node/xx)
2.Go to primary links and create a menu.under the menu link title provide the node number(the node number under which the page have been created)
3.Now when you click the menu it will be taken to the corresponding page.
Thanks
Balaji
#2
There is no such option. For that to happen, we'll need to introduce a hook, which will be invoked after the node/comment is saved. This way you'll have the node object, and you'll be able to act upon.
#3
Re: Comment #1 - That would defeat the purpose of having it updated via E-Mail.
Re: Comment #2 - Any chance of getting that implemented in a dev version soon? I'm sure it's not overly complicated to do but my PHP is quite rusty :(
#4
Marking as feature request
#5
Attached patch introduces a new hook: mailhandler_post_save($nid, $type)
$type is "node" or "comment".
$nid is either a node id or a comment id, depends on $type.
#6
So how does specifying $nid and $type generate a menu link? Or is just for the basis of further patches/modules to take advantage of? If it's the latter, is there any chance you could provide an example or another patch that would allow the creation of menu links?
#7
This patch adds a hook to mailhandler. You can implement this hook in a stand-alone module, to create menu items out of newly created nodes.
It wouldn't be scalable to do everything in mailhandler.
This is as far as we'd go, with regards to the feature request. It lets you do whatever you want with the node, including adding a menu item for it, change the url alias, add a reference to another node etc...
#8
Is there any chance you can have mailhandler create a menu link either inbuilt or using the hook as that is what I originally required?
#9
@acecombat: no, I won't add that specific feature in mailhandler. As I explained, it wouldn't be scalable. I created a hook for you to use, in order to accomplish the task. With $nid, you can probably do about anything with your node, but you'll have to do it yourself :-)
#10
Committed
#11
Automatically closed -- issue fixed for 2 weeks with no activity.