--- tellafriend.module 2008-06-12 18:41:16.000000000 -0400 +++ ../www/prch/sites/all/modules/tellafriend/tellafriend.module 2008-10-28 10:16:12.000000000 -0400 @@ -212,9 +212,10 @@ function tellafriend_block($op = 'list', else if ($op == 'view') { switch ($delta) { case 0: + $destination = drupal_get_destination(); $block = array(); if (user_access('access tellafriend form')) { - $blockContent .= ''; + $blockContent .= ''; $block['content'] = $blockContent; $block['subject'] = variable_get('tellafriend_block_title', t("Spread the world...")); } @@ -275,8 +276,9 @@ function tellafriend_page() { $form['submit'] = array('#type' => 'submit', '#value' => t('Tell now!'), + '#return' => $_GET['destination'], ); - + return $form; } @@ -349,7 +351,7 @@ function tellafriend_page_submit($form_i $addresses = implode(', ', $sendaddress); watchdog('mail', t('%sender sent an e-mail to %recepient using Tell a friend form.', array('%sender' => $form_values['tellafriend_name'], '%recepient' => $addresses))); drupal_set_message(t('Thank you! Your message has been sent to: !recepient', array('!recepient' => $addresses))); - drupal_goto(variable_get('tellafriend_success', variable_get('site_frontpage', 'node'))); + drupal_goto($form_values['submit']['#return'], 'node'); }