Would be great to be able to use a !title token for the message subject in print_email.

Comments

jcnventura’s picture

Status: Active » Postponed

Yes, it would be nice. Let's see if someone else does it or maybe when I have enough time available for that.

João

ron_s’s picture

A token would be nice, but what about something simple like just displaying the node title on the "Send page by e-mail" page? At least let the user have confirmation of what page he or she is sending.

This is a quick way I added this functionality to the print_mail.inc file (FYI, the l function used here is for Drupal 5, not Drupal 6) --

1) Around line 39 in the print_mail_form function, add the following line of code:

  $path = implode('/', $path);
  $page = node_load($path);  // ADD THIS LINE OF CODE
  if (is_numeric($path)) {
    $path = 'node/'. $path;
  }

2) Around line 81 in the print_mail_form function, add the following lines of code:

  $form['fld_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject'),
    '#size' => 62,
  );
  // *** START - ADD FORM FIELD ***
  $form['fld_node'] = array(
    '#type' => 'item',
    '#title' => t('Page to be sent'),
    '#value' => t(l($page->title, $path, array('title' => 'View page.', 'class' => 'mail-page'), NULL, NULL, FALSE, TRUE)),
  );
  // *** END - ADD FORM FIELD ***
  $form['txt_message'] = array(
    '#type' => 'textarea',
    '#title' => t('Your message'),
    '#rows' => 6,
  );

I'm sure this can probably be streamlined, but a quick fix.

ron_s’s picture

Status: Postponed » Needs review

I think it's worthwhile to review the code I posted and see if it should be added ...

jcnventura’s picture

Status: Needs review » Postponed

@ron_s: I don't see why your patch would be useful.. The user will click in a link in the original page, so he already knows which page he is sending.
And you're not even answering the original request..

João

ron_s’s picture

@jcnventura: The patch is useful because users like confirmation. It sets their mind at ease that the system has recorded their selection. This is somewhat like saying "Why do we need to show items in a shopping cart? The user added the product." Showing them what they have selected makes the functionality more user-friendly. Also I'm not sure if you're aware, but the Forward module already has this capability.

As for the token, yes you are correct it does not fully answer the original request. My point though is what I have added could easily be extended and pre-loaded in to the subject field (which is the way the Forward module does it).

jcnventura’s picture

@ron_s: I see your point. Your patch is a bit overkill (all the complexity of a node_load), which I am pretty sure might be avoided if all we want is the title. Next time that I have some free time, I will try to work something out.

jcnventura’s picture

Status: Postponed » Fixed

Just committed some code that adds the !title token to the subject field and also the page title (and link) to the form.

João

Status: Fixed » Closed (fixed)

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