Page 1 of 1
Hack: Improving the New Item email notification
Posted: Thu Oct 06, 2005 5:42 pm
by chadness
Have you ever wanted to know more than just that a new private message has arrived when your users submit items? How about, what they submitted and a quick link back to your administration panel?
OK, here's what to do.
In your language file (for example, if using english, your /language/english.php file), change your _ON_NEW_CONTENT line to this (customize it how you like):
Code: Select all
DEFINE('_ON_NEW_CONTENT', "Hello,\nA new content item has been submitted by [ %s ] titled [ %s ] for the section [ %s ] and category [ %s ].\nPlease go to $mosConfig_live_site/administrator/ to view and approve this article.\nPlease do not respond to this message as it is automatically generated and is for information purposes only." );
Then go in to /components/com_messages/messages.class.php, and delete these two lines (should be 84 and 85):
Code: Select all
$subject = _NEW_MESSAGE;
$msg = _NEW_MESSAGE;
Then, in the next line (formerly 87), change $msg to $message, like so:
Code: Select all
mosMail($mosConfig_mailfrom, $mosConfig_fromname, $recipient, $subject, $message);
This will make it email using the same subject and message line that is in the private message.
[edit - included reference to the language file]
Re: Hack: Improving the New Item email notification
Posted: Wed Jul 12, 2006 5:41 pm
by jackbremer
OK, here's what to do. Try changing your _ON_NEW_CONTENT line to this (customize it how you like):
in which file though? I've tried changing things in the following files:
/components/com_content/content.php
/components/com_messages/messages.class.php
neither seem to work, wherever I add in that code or wherever I modify something. I have now got the emails more useful, and showing the contents of the actual private message, but nothing works to include your polite message. I think you have simply ommitted to inform us which file we should add that code to!
Thanks in advance for your assistance...
Re: Hack: Improving the New Item email notification
Posted: Wed Jul 12, 2006 5:53 pm
by chadness
Good point - I didn't make that very clear. _ON_NEW_CONTENT is one of the variables in your language file. So, if you are using english, you would change it in /language/english.php .
Re: Hack: Improving the New Item email notification
Posted: Wed Jul 12, 2006 7:03 pm
by jackbremer
AWESOME! thanks for the speedy response too... once I managed to undo all the changes I'd done it worked a treat!
Cheers, and keep up the great work.
Mods/Admins feel free to clean up this thread now to include reference to the language file in the original post...
Re: Hack: Improving the New Item email notification
Posted: Wed Jul 12, 2006 7:19 pm
by chadness
jackbremer wrote:AWESOME! thanks for the speedy response too... once I managed to undo all the changes I'd done it worked a treat!
Cheers, and keep up the great work.
Mods/Admins feel free to clean up this thread now to include reference to the language file in the original post...
Done. I'll leave the comments in case anyone else was wondering where that was.
Re: Hack: Improving the New Item email notification
Posted: Fri Jul 14, 2006 7:53 am
by Lionel
Very cool. Actually the first part in language file was already in there. Changing the class made it work.
Now, can that email be linked to the content?
Re: Hack: Improving the New Item email notification
Posted: Fri Jul 14, 2006 8:51 am
by jackbremer
Indeed Lionel, it was in there originally, and this simply makes it more polite and provides a link direct to the administration panel.
I suppose if we knew what the content's variable name was we could include that too? I don't quite understand how it knows which bit refers to which when they are listed simply as $s for each variable in the language file... any ideas?
Re: Hack: Improving the New Item email notification
Posted: Mon Jul 24, 2006 3:32 pm
by Ottobufonto
Doea anyone know whether this will make it into J! 1.5 or whether there is a module/component about to handle this???
Such basic functionality - its astounding...
If not - I'll try the hack for now.
Re: Hack: Improving the New Item email notification
Posted: Mon Jul 24, 2006 3:35 pm
by cozimek
Ottobufonto,
I don't believe this will be included in 1.5, but if you can come up with a good modeled hack, I'm sure we can persuade the core to include the functionality into 1.6, etc.
Best,
Ryan
Re: Hack: Improving the New Item email notification
Posted: Mon Jul 24, 2006 3:45 pm
by Ottobufonto
I didn't mean I would write a hack... well I can try - but J! 2.0 might be out before that... :-)
I have seen the "email me on new message", but I think this should be a configurable system where you can select receipients from publisher list against differnt sections of the page... instead of admin..
When I said basic - I didn't mean simple. just something that a cms should do.... user a) submits content to b) or c) or d) and based on set of rules differnt publishers get notified to approve content.... implementation is probably for from trivial.
Otto