Closed (won't fix)
Project:
Simplenews
Version:
5.x-1.4
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
2 Sep 2008 at 17:23 UTC
Updated:
5 Jun 2013 at 06:20 UTC
Hi,
I'm digging through the simplenews.module file, and I can't find where to remove the "Newsletter Type" from the subject line. I only want the node title to appear. So, I'd like to remove everything in brackets, including the brackets themselves.
I've tried a few things.
Any help is appreciated.
kyle
Comments
Comment #1
sutharsan commentedYou can override the theme function responsible for theming the node body and title output.
Comment #2
kyle.vh commentedfunction theme_simplenews_newsletter($node, $tid) {
$term = taxonomy_get_term($tid);
$node->subject = '['. $term->name .'] '. $node->title;
$node->body = ''. $node->title ."\n". $node->body;
return $node;
}
Change above to this:
function theme_simplenews_newsletter($node, $tid) {
$term = taxonomy_get_term($tid);
$node->subject = $node->title;
$node->body = ''. $node->title ."\n". $node->body;
return $node;
}
*(the < h > code gets stripped out when I post this, so the third line of code is messed up, but I didn't change it).
Right? Is that what you're suggesting? When I try this, the subject of the email is still: "[tax term name] Node title". I'm trying to yield: "Node title".
Thanks for any ideas.
kyle
Comment #3
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #4
Babalu commentedsubscribing
for D6 Version please
Comment #5
sutharsan commentedNO. See #1 and http://drupal.org/theme-guide
Comment #6
kevster commentedD6 - If you look around line 2414 of simplenews.module you will find:
return '['. $name .'] '. $title;
which you can then edit...
Comment #7
jwaxman commentedSure would be nice to be able to set the title without having to hack the module.
Some sort of token scheme to allow the newsletter name and node title to be entered easily would be perfect.
Comment #8
miro_dietikerAs Sutharsan told:
For 5.x this is themeable - so don't hack the module but override the theming function.
For 6.x this is configurable. However 5.x is feature frozen so we won't backport this configurability.
Comment #9
freelylw commented@miro_dietiker, 'For 6.x this is configurable'
My question is just where can I configure this in 6.x ? the bracket tile just looks unreasonable,nobody need this I guess.
Comment #10
n4te02 commentedInstead of editing the module itself...In D6, just copy the function, place it in your template.php folder, and edit out the "'['. $name .']'" part.
function theme_simplenews_newsletter_subject($name, $title, $language) {
return $title;
}
Replace "theme" with your theme name and done!
Comment #11
tryitonce commented...... thanks - very useful - might be good to make sure this is easily found in the documentation.
Comment #12
plan9 commentedThe Simple News template module also controls the subject line: http://drupal.org/project/simplenews_template
If you have this module installed you need to override the theme function: theme_simplenews_template_mail_subject()
You do not need to override or hack simplenews in this case.
Comment #13
maikeru commentedThe problem with replacing the function in your template.php is the current problem with simplenews sending with the admin theme when using cron.
Even putting theme_simplenews_newsletter_subject into my admin themes template.php didn't work.
To get around this, I created a small module with the following in its sitehelper.module file:
Comment #14
brunox commentedThis thread was very helpful in helping me to figure what was going on.. All i did was to ensure that the administration theme is the theme I'm working in(it was also the default theme) and the "Use administration theme for content editing" box is checked on the /admin/settings/admin page.. then I added the following in my template file.. worked like a charm..
PS version 6.x-1.3...
Comment #15
JCB commentedI can confirm #13 worked for me (using D6 Simplenews 6.x-1.4)
Here is my code used in my "custom" module.
Would it be possible to use global variables to use this as a dynamic solution for all my drupal sites?
By using Global site name and base path / website URL instead of having to hard-code it?
How would I go about doing this?