Closed (fixed)
Project:
Subscriptions
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
29 Sep 2005 at 16:44 UTC
Updated:
17 Mar 2007 at 01:01 UTC
Jump to comment: Most recent file
Comments
Comment #1
dziemecki commentedCould you attach your full module? I'm afraid this module is a moving target, so the lifespan of a patch is somewhat short. It's actually easier for me to run this through a diff editor and merge as required.
Thanks,
dz
Comment #2
mindless commentedI've attached our full file.. it contains the patch discussed here plus a couple other changes.
One marked with:
/* Don't show subscribe-post link on the front page */
The other with subscriptions_settings2 and mailqueue_insert code.
Comment #3
mindless commentedI've attached my current subscriptions.module code for drupal 4.7.x which includes themable email content and a callout to mailqueue module if available.
Comment #4
mindless commentedAnd here is the mailqueue.module we use with it..
Comment #5
somebodysysop commentedI was just about to post the question "Is it possible to show the content title in Subscriptions Module e-mail notifications", when I came across this thread. This is great!
I assume with this patch it now is possible, but one question: How do I use it? The e-mail is now themable, but what does that mean? Is there documentation available, a sort of step by step how-to?
Thanks so much!
-ron
Comment #6
mindless commentedThere are now theme_subscriptions_emaildata and theme_subscriptions_email functions. This means in your theme you can define themename_subscriptions_emaildata and _email functions to override the default behavior. Here's what the two functions are for: _emaildata retrieves whatever data will be needed to generate the email contents.. it is called once. _email is called once for each user that receives an email for this change.. it is given the userinfo/recipient and the data generated from the _emaildata call. Take a look at these two functions in subscriptions.module and you'll see how they work. Copy them into your theme, rename them to themename_subscriptions_* and modify to suit your needs.
Comment #7
somebodysysop commentedThank you very much. I understand everything except one (and please forgive my ignorance because I'm very, very new to Drupal):
Where in the theme do you copy the two functions? Let's say I'm using the default Pushbutton theme. In it's directory are several files. Which file in the pushbutton theme directory do I add:
Last question. Thanks!
Comment #8
somebodysysop commentedOK, for all the other newbies out there, I figured it out.
In the case of standard themes that come with the Drupal download and use phptemplate.engine, all you have to do is create a php file called template.php, put the functions inside of it, change the function name "theme" to the theme name, and put the file into your theme directory.
For example, if your theme is "pushbutton", then create a file called template.php with the following two functions from mindless's subscription_47.module update (note that I have changed the function names, replacing 'theme_' with 'pushbutton_' and also I modified them from the originals):
Place this file into your themes/pushbutton directory, and you are good to go.
A word about my modifications: When a user subscribes to a content type, the default message he got said nothing about the nature of the content that has been updated:
I wanted the message to say what type of content type as well as the title of the node. Hence my modifications to the two functions above that now give me the following:
Note that I haven't tested this with all content types, so buyer beware! But, I do hope this helps someone who might have been as lost as I was.
-ron
Comment #9
mindless commentedAttached latest file, merged with recent cvs changes.
Comment #10
patchak commentedWhen I install the last file posted here, I can change the email content, but I don't why the subscribe checkboxe disappeards for all members on all created content. They can still subscribe by clicking a link on the content after it is posted, and the autosubscribe seems to work (after they update their account) but the checkboxes are gone on the content form for members who don't have autosubscribe!!!
I guess I would have to download the latest version of this module abd the patch it??
Or as this patch been committed to the module yet??
Thanks
Comment #11
patchak commentedoups sorry... It should read I don' know why, but the 'subscribe' checkbox disappears from the content creation form for all members... AUto subscribe works and subscription to content works also as welll... But for a user who does not have the auto subscribe, the checkbox to subscribe is gone.
Should I take the latest module in 4.7 and then patch it, instead of using this one attached here?
Thanks
Comment #12
dziemecki commentedYou may want to take that up with mindless. I can only support the code I post. Right now, the Drupal repository has what I consider to be the latest and greatest.
Comment #13
patchak commentedyes, well since you added the option to display the node title in the mail, I guess I don,t *really* need this patch anymore...
Thanks
Comment #14
__Tango commenteddziemecki: Do you plan on incorporating this patch into the default Subscriptions codebase?
I have a need for this exact feature + the ability to send out MIME email. Mindless' patches have been around for a while, so i was wondering if you are going to incorporate the changes or if you expect that this will always be a one-off type scenario.
Comment #15
dziemecki commentedFrankly, I haven't really looked that closely at the patch. Right now, I'm focused on bugs. However, I've left this open because I intend to revisit it. Can't make any promises about when, however, but I don't see anything here that is fundamentally at odds with the goals of the module.
Comment #16
mindless commentedAttaching our latest code, up to date with DRUPAL-4-7 branch in CVS.
Comment #17
arthurf commentedHey Mindless- would you mind actually submitting a patch and not the module? I've done a good chunk of changes in the last bit and it would be much easier to get your changes in if I could do the line by line comparison. I would like to get this functionality in place.
thanks!
Comment #18
arthurf commentedFYI, I think the hook_mail_alter() should help with this in the 5.0 version, but I'd like to implement the actual themability that you suggest here.
Comment #19
mindless commentedI attach the full file here due to the request in comment #1. I think you can get the version from the right date from cvs and diff against the file above. Thanks!
Comment #20
arthurf commentedI've added theming functions for headers, subject and body. This is currently only in the 5.0 branch, and in cvs
Comment #21
mindless commentedthanks for incorporating this functionality. i do need a change before this code will work for how we theme the email.. the subject function needs to send more parameters. right now it only sends the variables needed for the default implementation.. but our theme includes the forum and node titles in the subject.. can't do this without more information given to that theme function.
other comments:
- I suggest subscriptions_sendmail have separate $from and $headers parameters to match the 5.x drupal_mail function. right now you're passing $headers to that function and giving that as the drupal_mail $from parameter. probably also the default theme headers function should just return X-Sender: Drupal. giving $from to drupal_mail will add those other things.
- I suggest you use a static $cache in the theme body function for the db query on comments table. otherwise if you have 50 subscribers to a node you'll do that query 50 times. using caching in the default theme function will also help themers realize they should do this too to avoid a performance hit on their site.
thanks!
Comment #22
mindless commentedhope it's ok, i'm setting this back to active. also changing to 5.x-dev version as that's where i'd like to see this feature. i can provide a patch implementing my suggestions if needed, but it seems you're pretty active in development recently so maybe you'll get to it :-)
Comment #23
arthurf commentedPoints taken on the static, and on more options on subject, body, etc. I'm going to try do do some fairly significant refactoring of this so that the code is not such a rats nest in this area. I'll try to figure out a better way to pass data so that one can do more theming options with it more easily.
Comment #24
mindless commentedadded more parameters to the theme functions in DRUPAL-5 branch. now there's enough information that my theme can get the details it needs.
Comment #25
(not verified) commented