Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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!
Comment | File | Size | Author |
---|---|---|---|
#10 | print_mail_different_url-844612.patch | 1.91 KB | peterx |
#8 | print_mail_different_url-844612.patch | 1.91 KB | peterx |
#7 | print_mail-844612.patch | 966 bytes | peterx |
Comments
Comment #1
jcnventura CreditAttribution: jcnventura commentedYes, of course.
Simply edit print_mail/print_mail.module and change the PRINTMAIL_PATH define to 'tellafriend'.
João
Comment #2
YK85 CreditAttribution: YK85 commentedHi 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!
Comment #3
jcnventura CreditAttribution: jcnventura commentedThere's no better solution, no.. Sorry.
Comment #4
YK85 CreditAttribution: YK85 commentedIf 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
Comment #5
jcnventura CreditAttribution: jcnventura commentedNot for the short term..
Comment #6
modiphier CreditAttribution: modiphier commentedI tried changing the PRINTMAIL_PATH to tellafriend and tell-a-friend and in both instances I got a page not found.
Comment #7
peterx CreditAttribution: peterx commentedI 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.
Comment #8
peterx CreditAttribution: peterx commentedHere 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.
Comment #9
jcnventura CreditAttribution: jcnventura commentedThe 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.
Comment #10
peterx CreditAttribution: peterx commentedI changed
print_mail_form_from_path
toprint_mail_form_for_path
in the patch for anyone using your modified code.Comment #11
jcnventura CreditAttribution: jcnventura commented@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.
Comment #12
mobiro CreditAttribution: mobiro commentedSo, how to change that 'printmail'?
maybe 'printpdf' too?