I'm integrating a custom module with the ecard module. I don't want to use the standard form, and have instead created my own. As a result I wanted there to be a 'ecard_send_card()' function which I could call with all the necessary information and the card(s) would be sent. Currently all of this code logic resides in the submit handler for the standard form. I've split it out into its own function so now I can avail of the same functionality via a handy api call.

Cheers,
Stella

Comments

stella’s picture

StatusFileSize
new5.41 KB

oops spotted a mistake when notifications are disabled. Fixed now.

kars-t’s picture

StatusFileSize
new5.87 KB
+++ ecard.module	19 Oct 2009 17:05:20 -0000
@@ -375,13 +375,43 @@ function ecard_form_validate($form_id, &
+  $form_state['nid'] = $node->nid;

This gives me a PHP Notice and I can't understand why you do this and where $node comes from?

I reworked the patch a bit. Biggest change is that I removed the random handling to make it a bit faster and uncomplicated. The version to generate MD5 hashes till you find one not in the database is very secure. But as there is no transaction active not 100% secure. So hashing microtime with some salt should be fair enough.

Please take a look at it so we can submit this :)

I'm on crack. Are you, too?

stella’s picture

Status: Needs review » Reviewed & tested by the community

Hmmm looks like that line was in the original ecard_form_submit(). I don't see any need for it, so it can probably be removed alright. The new patch looks good, especially the new random key generation.

kars-t’s picture

Status: Reviewed & tested by the community » Fixed

#608684 by stella, Kars-T: Added split sending of ecards into an API call.

Commited.

Status: Fixed » Closed (fixed)

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