Hack: Improving the New Item email notification

Moderator: mcsmom

Post Reply
User avatar
chadness
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Mon Aug 22, 2005 5:43 pm
Location: Minneapolis, MN
Contact:

Hack: Improving the New Item email notification

Post by chadness » Thu Oct 06, 2005 5:42 pm

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]
Last edited by chadness on Wed Jul 12, 2006 7:19 pm, edited 1 time in total.

User avatar
jackbremer
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Jul 12, 2006 5:37 pm
Location: London, UK

Re: Hack: Improving the New Item email notification

Post by jackbremer » Wed Jul 12, 2006 5:41 pm

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...

User avatar
chadness
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Mon Aug 22, 2005 5:43 pm
Location: Minneapolis, MN
Contact:

Re: Hack: Improving the New Item email notification

Post by chadness » Wed Jul 12, 2006 5:53 pm

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 .

User avatar
jackbremer
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Jul 12, 2006 5:37 pm
Location: London, UK

Re: Hack: Improving the New Item email notification

Post by jackbremer » Wed Jul 12, 2006 7:03 pm

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...

User avatar
chadness
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Mon Aug 22, 2005 5:43 pm
Location: Minneapolis, MN
Contact:

Re: Hack: Improving the New Item email notification

Post by chadness » Wed Jul 12, 2006 7:19 pm

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.

Lionel

Re: Hack: Improving the New Item email notification

Post by Lionel » Fri Jul 14, 2006 7:53 am

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?

User avatar
jackbremer
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Jul 12, 2006 5:37 pm
Location: London, UK

Re: Hack: Improving the New Item email notification

Post by jackbremer » Fri Jul 14, 2006 8:51 am

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?

Ottobufonto
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Tue Sep 06, 2005 10:53 pm

Re: Hack: Improving the New Item email notification

Post by Ottobufonto » Mon Jul 24, 2006 3:32 pm

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.

User avatar
cozimek
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 137
Joined: Thu Aug 18, 2005 1:27 pm
Location: Washington, DC
Contact:

Re: Hack: Improving the New Item email notification

Post by cozimek » Mon Jul 24, 2006 3:35 pm

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
PICnet - "Empowering the missions of non-profits through technology"
www.picnet.net

Ottobufonto
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Tue Sep 06, 2005 10:53 pm

Re: Hack: Improving the New Item email notification

Post by Ottobufonto » Mon Jul 24, 2006 3:45 pm

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


Post Reply