Ecard should let you optionally have the sender name and email filled in automatically for authenticated users to save them some work when sending an ecard. Patch against CVS included.

Comments

kars-t’s picture

Status: Needs review » Needs work

I think this is a good idea.
But please reroll the patch against the latest CVS version of Branch 6.1. This patch is against latest release version 1.1.4.7. Current version is 1.1.4.15. And if you are really cool please make a patch agains version 6.2 as well! :D

mmccollow’s picture

Status: Needs work » Needs review
StatusFileSize
new2 KB
new1.98 KB

My apologies, still new to CVS! Here are patches for DRUPAL-6--1 and DRUPAL-6--2.

kars-t’s picture

Status: Needs review » Needs work

Great thanks! Took me around 3 Weeks to get a grip on CVS and I still hate tags and branches. You are really not alone! ;)

+++ ecard.module	19 Nov 2009 20:49:41 -0000
@@ -271,6 +276,24 @@ function ecard_nodeapi(&$node, $op, $tea
+function get_user_name() {
...
+function get_user_mail() {

Maybe we could just use

'#default_value' => variable_get('ecard_fill_in_name_email', 0) && user_is_logged_in() ? $GLOBALS['user']->mail : '',

instead of a function. Currently I think this should be enough but I will think about this. The current function names are problematic because there could be naming conflicts as we lack name-spaces. Maybe "ecard_get_user_mail" would be enough but it feels like some API piece missing or already existing that should not be part of the ecard module. Maybe I find something fitting in the API.

+++ ecard.module	19 Nov 2009 20:49:41 -0000
@@ -282,13 +305,15 @@ function ecard_form($form_state, &$node)
+    '#default_value' => get_user_name()

Minor thing: The coding conventions say that there has to be a comma at the end of every array item.

And another minor thing: IMO such API functions should move to the end of the file. But this is really cosmetic and I use IDE's that have an code outline that is alphabetic.

This review is powered by Dreditor.

mmccollow’s picture

Status: Needs work » Needs review
StatusFileSize
new1.61 KB
new1.59 KB

You're right, the ternary statements are much more concise and suitable than functions here. I've made that change and added commas to the end of those array items.

kars-t’s picture

Status: Needs review » Fixed

#637462 by mmccollow | Kars-T: Added Automatically fill in sender name and email for authenticated users.

Commited to both branches! :D

@mmccollow If you are using the dev version could you please send me a mail if it runs fine? If not stay tuned for simpletest.

Status: Fixed » Closed (fixed)

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