I like to make a plugin that sends out a mail when a new document is created.
I think I can use OnDocFormSave, but how do I get the insert id? I like to get the id so that I can generate a link to put in the mail.
all the availible fields for plugin creation are hard to find what you can use.
is there a posibility to get the inserd id from the db when using OnDocFormSave or is this event to soon and is the id not given to the document yet?
there is no AfterDocFormSave event.
does anyone know a way to do this?
dimmy
-
☆ A M B ☆
- 24,524 Posts
Looks to me like the new doc’s ID is available:
// invoke OnDocFormSave event
$modx->invokeEvent("OnDocFormSave", array (
"mode" => "new",
"id" => $key
));
Although how you would access that in a plugin is more than I know
ok I got the id thank you so much:
$mailid = $modx->event->params[’id’];
now connecting it to the mailing list.
greets Dimmy
-
☆ A M B ☆
- 24,524 Posts
Well, now I know! Thank YOU
mm what i realy miss in developing plugins are error messages, now I just get a white screen so somthing goes wrong but nothing is logged or displayed on screen.
verry frustrating changing stuf and then save and test if not working change again save again test again etc etc.
I feel that I am close to get this plugin working.
will try more and see if it works.
mm I could take alook but I am just a beginner and not that good (yet)
would be good to extent this so building plugins wil be much more easy.
Dimmy
Ok I got the plugin working.
now I would like a popup to that asks if this page needs to be send with yes or no.
is this posible in a plugin?
I tryed javascript but that did not work and the modx->alert() only gives alerd bit no yes or no.
Dimmy