Hello,

I would like to change the Send by-email page url from www.example.com/printmail/nid to www.example.com/tellafriend/nid

Is it currently possible to change the printmail to tellafriend?

Thank you!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jcnventura’s picture

Status: Active » Fixed

Yes, of course.

Simply edit print_mail/print_mail.module and change the PRINTMAIL_PATH define to 'tellafriend'.

João

YK85’s picture

Status: Fixed » Active

Hi João,

If I change the path in the print_mail.module it would be difficult to update the module right? Is there a better solution? I really appreciate your help!

jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)

There's no better solution, no.. Sorry.

YK85’s picture

Category: support » feature
Status: Postponed (maintainer needs more info) » Active

If it is ok with the maintainer - I would like to change this as a feature request. I believe allowing in the settings to define the URL would allow greatly flexibility and usage for a wider audience of this awesome module.

This would allow for this different combinations:
www.example.com/printmail/nid
www.example.com/share/nid
www.example.com/tellafriend/nid
etc

I hope someone would be able to help add this feature to this module!

Thank you

jcnventura’s picture

Status: Active » Postponed

Not for the short term..

modiphier’s picture

I tried changing the PRINTMAIL_PATH to tellafriend and tell-a-friend and in both instances I got a page not found.

peterx’s picture

Version: 6.x-1.x-dev » 7.x-2.0-beta1
FileSize
966 bytes

I have the same requirement and created a small module to generate the path then call print_mail_form. There was a problem with the print_mail_form URL processing so I split print_mail_form into two functions with the first creating the path and the second using the path. My module can then call the second function. The patch is attached.

The function is split into print_mail_form and print_mail_form_from_path. print_mail_form_from_path accepts a path to print from any module and, optionally, a user in case you want to print on behalf of someone else.

Another way to handle the same request could be an optional nid in print_mail_form.

I will attach an example module next.

peterx’s picture

Status: Postponed » Needs review
FileSize
1.91 KB

Here is an example contrib module named print_mail_different_url using a URL in the form jobs/example_item/printmail. You could set it to process anything by altering line 15 to a different URL format then line 34 to convert the URL to a path for print_mail_form_from_path.

jcnventura’s picture

Status: Needs review » Postponed

The patch in #7 seems harmless enough and maybe useful for other purposes.. Committed (with name change) in http://drupalcode.org/project/print.git/commit/7815650

The custom module in #8 will obviously remain outside of the module. It's a solution a lot more complicated than the simple variable setting and getting (+ menu cache flush) that is needed here.

peterx’s picture

I changed print_mail_form_from_path to print_mail_form_for_path in the patch for anyone using your modified code.

jcnventura’s picture

@peterx: wait for the 7.x-2.0 release. I may have to pass another argument there because of #1358770: Send by email feature has bug when node has arguments.

mobiro’s picture

So, how to change that 'printmail'?
maybe 'printpdf' too?