I like this module very much. I realize that Forward works only with nodes. I would like to be able to extend it to be able to use it to just send a link to a page.
I have written a module that is called using www.mysite.com/mymodule/1234
I would like to put the collapsible fieldset on it with the form that allows the user to fill out the forward form. When the Send Message button is hit, it emails a link to www.mysite.com/mymodule/1234 to the recipient along with the usual items.
I'm hoping that you or someone would be willing to make revisions to this module. I think it will add a lot of usability to module developers. I have $50 to kick in for this. I know it's not much but it would be awesome to have it done properly.
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | forward-admin.jpg | 58.15 KB | manoloka |
| #25 | Screenshot | 19.21 KB | missym |
| #19 | forward.zip | 10.72 KB | seanr |
| #15 | forward.zip | 10.72 KB | seanr |
| #12 | forward.module.patch | 13.57 KB | seanr |
Comments
Comment #1
manoloka commentedI hope someone helps you and you decide to share it :-), I asked in a different issue but the guy says that it can only forward nodes and that is that :-$
Comment #2
missym commentedI'm hoping that other's will pitch in to make it worth someone's while to make a revision to this module for everyone.
Comment #3
seanrIf someone can produce a patch I'll commit it but the problem is I know of know easy way to get the body content when not accessing a node.
Comment #4
missym commentedActually - I really like the user interface and the way the module keeps forwarding statistics. I would like to use your module to put up the default forwarding form and, if it's not a node page, a link to a page defined by a variable (or, if the variable is empty, the current page), with the option of overriding the url.
For example:
This URL : www.mysite.com/mymodule/mypage has a forwarding link on it.
When I call the page I set up a variable called LINKTOSEND containing a URL. The forwarding form, realizing we are not on a node page, has a "Send This Link" form with the variable LINKTOSEND populated. If LINKTOSEND isn't populated, the current URL is in the field. The field can be changed by the user.
When the user hits send, the link is listed below your personal message. The page content is not included - just a link to it.
Is this doable?
Comment #5
seanrThe print module offers functionality that is along similar lines (putting a print link on non-node pages). I think that might make a decent model for this; I'll look into it.
Comment #6
missym commentedThanks, Sean
Comment #7
missym commentedI also have another suggestion while you are looking at the code. If the forward and the search forms are both on the page at the same time, it creates two divs with ID="edit-submit". I am guessing that it's the default ID on the form API. Anyway, it makes the markup invalid because ID needs to be unique. So if you are into it, maybe you can define the ID for this form as "forward-submit" or another unique identifier. It might be the submit button id. I tried to figure it out but I couldn't see how it worked.
A snip of the code is below:
Thanks.
edited by: VeryMisunderstood; Added code tags around HTML code so HTML could be read
Comment #8
seanrMissyM, This is actually a separate issue that should probably be filed against Drupal core. If FAPI is by default generation invalid code (which I agree, it certainly is), that'd be a bug in core.
In the future, please always create a new issue if your comment isn't directly related to the issue at hand. Module maintainers will then be able to track the issues separately allowing them to mark one closed and still work on the other, and it'll mean less irrelevant clutter for people searching through the issues looking for solutions to their own problems. Thanks
Comment #9
missym commentedThank you -- I posted it elsewhere.
Comment #10
seanrOK, I got quite far with this, but ran into a potential showstopper. Please take a look at the attached patch.
With the attached patch, everything appears to work correctly. However, there is a currently a major security issue in that the permissioning in Drupal is based on the current user, not the user being emailed. What I need is some way to be able to take the current path and determine whether an anonymous user would have access to that path. Without that, a user with access would be able to email pages to people who should not have access to them and they'd be able to see the content in the email (though they wouldn't be able to follow the links).
Comment #11
missym commentedHi Sean --
I can't test it until this weekend but I think the best you can do about that is to document it to the user. Another alternative is to just email the link to the page but not the content. In that case, all the parameters to the page need to be in the URL (GET vs POST).
It is fine with me because I don't intend to use it for secure data but it is important that the function secure.
I'll let you know how it works for me next week.
Thanks --
Monique.
Comment #12
seanrThat's actually a pretty good idea. Please try the attached patch.
Comment #13
missym commentedHi Sean --
First, I apologize for not getting to this over the weekend. I am still into it. I'll do it Tuesday morning. I'm pretty lame with applying patches. I can't seem to get it worked out without just manually doing it. It will take some time but I'll do it.
Thanks -
Missy.
Comment #14
missym commentedHi Sean --
This looks great but I'm running into a couple of problems. I got a reject report when I tried to do the patch. I was able to do most of it manually but not the items below
" ***************
*** 336,345 ****"
I got the email form on the page but I couldn't actually send it because it kept requiring a name and it's probably because I wasn't able to roll in the entire patch. I can see, however, that this is great for anyone who might be doing support or sales because they can forward any page. As it is now (with the correct patch), it probably fulfills what several other users have asked for.
For my use, I need to be able to have the forward module on but have it set up to never show the Email This Page link unless I've included it the module that I'm writing. I looked through the code and couldn't figure out how to do that. If you can give me some guidance, I'd be happy to try it out.
It would be very handy to only have certain roles have the forward link on the nodes but it's probably a lot of work to do that.
So, can you help me include the forward module into a page from a custom module and can you help me figure out how to get the file patched starting from the code below " ***************
*** 336,345 ****"
Thank you!!
Missy.
I got this reject report when I tried to patch it:
***************
*** 34,40 ****
'path' => 'epostcard',
'title' => variable_get('forward_epostcard_title', t('Send an e-Postcard')),
'callback' => 'drupal_get_form',
- 'callback arguments' => array('forward_form'),
'access' => (user_access('access epostcard')),
'type' => MENU_NORMAL_ITEM
);
--- 34,40 ----
'path' => 'epostcard',
'title' => variable_get('forward_epostcard_title', t('Send an e-Postcard')),
'callback' => 'drupal_get_form',
+ 'callback arguments' => array('forward_form', 'epostcard'),
'access' => (user_access('access epostcard')),
'type' => MENU_NORMAL_ITEM
);
***************
*** 91,101 ****
/**
* Implementation of hook_help
*/
- function forward_help($section) {
- switch ($section) {
- case 'epostcard':
- case 'forward/'.arg(1):
- return t(variable_get('forward_instructions', '
'. t('Thank you for your interest in spreading the word on') .' '. variable_get('site_name', 'drupal') .'.
'. t('NOTE: We only request your email address so that the person you are recommending the page to knows that you wanted them to see it, and that it is not junk mail. We do not capture any email address.') .'
'));
}
}
--- 89,104 ----
/**
* Implementation of hook_help
*/
+ function forward_help($path) {
+ if (user_access('access forward') && (preg_match("/^node\//i", $path) == 0) && (variable_get('forward_display_nonnode', false))) {
+ if ($path === NULL) {
+ $path = PRINT_PATH ."/". $_GET['q'];
+ $query = drupal_query_string_encode($_GET, array('q'));
+ if (empty($query)) {
+ $query = NULL;
+ }
+ }
+ return ''. l(t('Email this page'), 'forward/'.$path, NULL, $query) .'';
}
}
***************
*** 336,345 ****
'#required' => true,
);
if (($user->mail) && !user_access('override email address')) {
- $form['message']['yemail']['#disabled'] = true;
- $form['message']['yemail']['#value'] = $user->mail;
}
- $form['message']['yname'] = array(
'#type' => 'textfield',
'#title' => t('Your Name'),
'#default_value' => $user->name,
--- 409,418 ----
'#required' => true,
);
if (($user->mail) && !user_access('override email address')) {
+ $form['yemail']['#disabled'] = true;
+ $form['yemail']['#value'] = $user->mail;
}
+ $form['yname'] = array(
'#type' => 'textfield',
'#title' => t('Your Name'),
'#default_value' => $user->name,
Comment #15
seanrYou need to have updated to the latest 5.x version of Forward to apply the patch (if you checked out from CVS, run cvs up -r DRUPAL-5--0 -C). Then see the docs here: http://drupal.org/patch/apply
In the meantime, see attached for a copy of the patched module.
Comment #16
missym commentedBeauty -- One small bug. The return page for link or forward doesn't appear to be going to the originating page. In all my tests, it returned to www.mysite.com/content. The email came through with the link perfectly. It would probably be prudent to check if you are on an admin page before including the "Email this Page" link.
Another suggestion, in the forward_log table, add a column for URL and populate it with the URL if nid = 0.
Thank you, Sean. Please privately send me your email address or your mailing address.
Missy.
Comment #17
seanrYou probably need to rebuild your menu cache. This is easiest if you have the devel module as it includes a link in it's block to do empty the cache, otherwise, visiting the admin/build/menu page should do it. If that doesn't work, please post a link to your site with the module enabled and I'll look at it.
Comment #18
missym commentedHi Sean --
I cleared the cache and it still returned to ../content. The test I ran was from a node. I selected Forward this page and it took me to a page with the address ../forward/5. The forward worked fine but it returned me to ../content.
M.
Comment #19
seanrAh, OK; I misunderstood your original post. See attached; this should fix it.
Comment #20
manoloka commentedI probably don't understand what this is meant to do.
I have installed the attachment in #19 and nothing seems to happen. My non node pages don't show any "Forward this " link.
Isn't this patch supposed to let you forward non node pages?
Do I need to do anything to those for them to get the "Forward Link"?
I'm a bit confused.
Manuel
Comment #21
seanrmanoloka: did you go to admin/settings/forward and turn it on? The feature is off by default.
Comment #22
missym commentedDid you go into the Forward admin page and set it up? Once you get it, can you test it out and let us know how it worked for you? Just put your feedback right here in this thread. Thanks.
Comment #23
missym commentedComment #24
manoloka commentedActually it was already set up, so nothing changed. I don't see anything different within the forward admin.
No forward link shows in non node pages, I'm just not sure what I am supposed to see now.
The Email this page/story/whatever show as usual in the nodes but that is all.
Do I need to do anything else, does the admin have anything to "tick" to forward non node pages? because my admin is exactly the same as before.
Comment #25
missym commentedSean --> I'm getting the same error. When I forward a node type page, it goes to ../content. When I forward a non-node page, it goes to a blank page with no headers (aka white screen of death).
Manoloka --> I've attached a screenshot. You can see there are non-node types. This mod is not finished yet but your help and/or testing is welcome.
Comment #26
manoloka commentedMissyM
I don't have the
See it in the picture attached.
I've uploaded the module to my server various times in case it could have been a problem there (and every time I did a new download).
So, I don't know, why ???
Comment #27
missym commentedManoloka --
I think it's kind of bad form to ask for help and advice on something that's a work in progress. We are trying to get this up and going. Erase it from your server, clear all your caches, put it on your server again and try it. If it works, please test and post your results here. If it doesn't, please wait until you see that it is done. BTW - if really want to see this done, it would be great if you could kick in some $$ for Sean who's been working really hard on it.
Thanks --
Missy.
Comment #28
manoloka commentedI'm sorry you feel like that, I thought you wanted help with testing, yet when I tell you that something isn't working, you seem to get upset about it ... ???
Sorry it wasn't my intention.
If you need anything else let me know, in the meanwhile I'll wait until it's finished.
Thanks anyway
Manuel
Comment #29
missym commentedNo bad feelings. Please understand that one does one's best to help by trying to solve the problem that is unique to their system then posting the solution rather than asking others to guess what is wrong. As far as we know, there are only two people who have it installed and neither is having trouble with the admin screen. If you figure it out, please post the solution here.
Comment #30
missym commentedSean --> It worked like a charm on your site. I will try to look through the code when I have a chance. If you have any clues or suggest any variables I should watch for that might make it easier for me, please let me know.
Comment #31
manoloka commentedHi, I've finally solved my problem and now it's installed and working.
It seems to work fine, it did what it has to do.
However, here you have what I see and my suggestions (if they're worth anything).
- I see the "Email this page" link in all the admin pages which is obviously not what you want to forward. I'd suggest to find a way so it doesn't show in any admin (or even in logged in) pages.
- I see the "Email this page" link on top of the content, opposite to all the nodes that have it below the content. Not a big deal, BUT its good practice to stick to one design as changing things of place will only confuse your visitors. Know what I mean?
In a taxonomy list page
- I see the URL in the link pointing to mysite.com/forward/taxonomy/term/124 instead of using the aliases (i.e mysite.com/forward/term-alias) not a big deal
- Once in the forward form, it says "You are going to email the following: Taxonomy " (yet the link is using the correct alias). Using "Taxonomy" instead the page title is a problem as it is most likely not going to mean anything to the person who sends and the one who receives the email
I noticed that the email gets the "Taxonomy" instead the page title. I would suggest using the page title because it's likely to make some sense to the reader.
Also. You seem to have used;
system_modules_util()
smtp_menu()
Those two are already used by other modules (Utilities http://drupal.org/project/util and SMTP http://drupal.org/project/smtp) which creates a conflict (Fatal error) if you have any of those modules installed (my case). I'd suggest you modify those declarations so it doesn't conflict with other modules.
I had to unistall these modules for this forward feature to work. Otherwise I'd get a Fatal Error.
Hope this helps
Comment #32
missym commentedThanks! SMTP and UTIL conflict with this module. That's good to know. I'm sure Sean will take your other ideas into consideration. Thanks for contributing. It is a great help!
Comment #33
manoloka commentedI've just noticed that the Forward Register didn't get it right.
Path is node/0 and no Title at all.
Type and Time seems to be fine.
Comment #34
todddevice commentedsubscribing
Comment #35
manoloka commentedI've just discovered that the smtp_menu() issue was a problem in my system and I suspect that the other maybe too, I'll keep looking into it and let you know when I found out.
sorry about that
Manuel
Comment #36
manoloka commentedAs I suspected the system_modules_util() issues was a problem with the Utility module.
I've been in touch with the maintainer and its solved now.
It seem to work fine .
I don't know if anything has been change.
I think it's important that on the "You are going to email the following: Taxonomy" shows the title page instead of taxonomy, or at least the taxonomy term itself.
Comment #37
john.oltman commentedThis feature was added in version 6.x