Kunena 6.3.7 Released

The Kunena team has announce the arrival of Kunena 6.3.7 [K 6.3.7] in stable which is now available for download as a native Joomla extension for J! 4.4.x/5.0.x/5.1.x/5.2.x. This version addresses most of the issues that were discovered in K 6.2 / K 6.3 and issues discovered during the last development stages of K 6.3
Note: Please go to the Kunena Dashboard after an upgrade so that the Kunena database tables are also updated.

Question Modify text in new post email notifications

More
13 years 8 months ago #1 by justmebg
How do I modify the text that appears in the new post notifications to users who have subscribed to a thread? I found a few old posts addressing this, but it looks like most of the structure mentioned has changed in 1.6, and I am having a heck of a time finding this.

Basically, by users want a more stripped down email, one that goes from this:

A new post has been made to a topic to which you have subscribed on the FSDR Forum

Message email format?
Forum: Suggestion Box & Site Updates
Posted by: FQ1962

You can administer your subscriptions by following the Profile link on the forum home page after you have logged in on the site. From your profile you can go to Subscriptions tab where you can unsubscribe from the topic.
URL: www.mydomain.com/index.php ?.....

Message:


message text here


Do not answer to this e-mail notification as it is a generated e-mail.


To something more like this:

Posted in forum: Suggestion Box & Site Updates by FQ1962

Message email format?:


message text here


You are receiving this message because you subscribed to a forum in the FSDR site. You can administer your subscriptions by following the Profile link on the forum home page after you have logged in on the site. From your profile you can go to Subscriptions tab where you can unsubscribe from the topic.
URL: www.mydomain.com/index.php ?.....

Do not answer to this e-mail notification as it is a generated e-mail.


Any help on how I can do this?

Please Log in or Create an account to join the conversation.

More
13 years 8 months ago #2 by sozzled
G'day, justmebg, and welcome to Kunena.

I refer you to the guidelines about posting questions in the support category:

...
Do not use this category:

▪ to request a change to the standard behaviour of Kunena.
...

I will try to find the information that might help you change the way that Kunena "routinely" produces email and post it for you. Please be aware that any changes that you make to the standard behaviour will not necessarily be retained if (and when) you upgrade from one version of Kunena to the next and that our ability to help you will be restricted when you make such changes.

There's no harm in asking for this information and I'll do my best to help you. I merely wanted to point out to you (and to others who may be in your situation) the risks that you may run ... even though your ideas are very good ones.

Speaking only for myself, I would like to see a future version of Kunena allow users the means to customise emails without having to make changes to the PHP source code ... but I think that might be a long time before this can be easily accomplished. :)

Please Log in or Create an account to join the conversation.

More
13 years 8 months ago #3 by justmebg
I absolutely understand, thanks for clarifying. My users are in the process of transitioning from a Yahoo! group format to the Kunena forum, and they are missing some of the simpler formatting in email notifications. As it is, they are being asked to take several additional steps of clicking a link and logging in.

If I can change the email format in only one or two files, then I am willing to do this and accept the headache every time I need to upgrade. However, if this requires extensive code changes I will let them know that this request will go on the "pending" list, and we'll just have to wait for some kind of email template system.

The other option would be to work some kind of plugin with en existing mailing system, like J!MailAlerts, which is an excellent system. If only I were a coder...

Please Log in or Create an account to join the conversation.

More
13 years 8 months ago - 13 years 8 months ago #4 by sozzled
I think the code that generates the email is contain in the file ../components/kunena/lib/kunena.posting.class.php. I could be wrong.

The code that seems to generate emails for subscribers seems to be located at around lines 924-1019 (the reference may be different in your version of Kunena), namely:
Code:
public function emailToSubscribers($LastPostUrl = false, $mailsubs = false, $mailmods = false, $mailadmins = false) { if ($LastPostUrl === false) { jimport ( 'joomla.environment.uri' ); $uri = JURI::getInstance ( JURI::base () ); $LastPostUrl = $uri->toString ( array ('scheme', 'host', 'port' ) ) . CKunenaLink::GetMessageURL($this->get ( 'id' ), $this->get ( 'catid' ), 0, false); } $once = false; if ($mailsubs) { if (!$this->get ( 'parent' )) { // New topic: Send email only to category subscribers $mailsubs = $this->_config->category_subscriptions != 'disabled' ? 3 : 0; $once = $this->_config->category_subscriptions == 'topic'; } elseif ($this->_config->category_subscriptions != 'post') { // Existing topic: Send email only to topic subscribers $mailsubs = $this->_config->topic_subscriptions != 'disabled' ? 2 : 0; $once = $this->_config->topic_subscriptions == 'first'; } else { // Existing topic: Send email to both category and topic subscribers $mailsubs = $this->_config->topic_subscriptions == 'disabled' ? 3 : 1; // FIXME: category subcription can override topic $once = $this->_config->topic_subscriptions == 'first'; } } // Fetch all subscribers, moderators and admins who will get the email $emailToList = CKunenaTools::getEMailToList ( $this->get ( 'catid' ), $this->get ( 'thread' ), $mailsubs, $mailmods, $mailadmins, $this->_my->id ); if (count ( $emailToList )) { jimport('joomla.mail.helper'); kimport('html.parser'); if (! $this->_config->email ) { KunenaError::warning ( JText::_ ( 'COM_KUNENA_EMAIL_DISABLED' ) ); return false; } else if ( ! JMailHelper::isEmailAddress ( $this->_config->email ) ) { KunenaError::warning ( JText::_ ( 'COM_KUNENA_EMAIL_INVALID' ) ); return false; } // clean up the message for review $authorname = $this->get ( 'name' ); $message = KunenaParser::stripBBCode ( $this->get ( 'message' ) ); $subject = $this->get ( 'subject' ); $topicsubject = $this->parent->subject ? $this->parent->subject : $subject; $mailsender = JMailHelper::cleanAddress ( $this->_config->board_title . " " . JText::_ ( 'COM_KUNENA_GEN_FORUM' ) ); $mailsubject = JMailHelper::cleanSubject ( "[" . $this->_config->board_title . " " . JText::_ ( 'COM_KUNENA_GEN_FORUM' ) . "] " . $topicsubject . " (" . $this->parent->catname . ")" ); $sentusers = array(); foreach ( $emailToList as $emailTo ) { if (! $emailTo->email || ! JMailHelper::isEmailAddress ( $emailTo->email )) { continue; } if ($emailTo->subscription) { $msg1 = $this->get ( 'parent' ) ? JText::_ ( 'COM_KUNENA_POST_EMAIL_NOTIFICATION1' ) : JText::_ ( 'COM_KUNENA_POST_EMAIL_NOTIFICATION1_CAT' ); $msg2 = $this->get ( 'parent' ) ? JText::_ ( 'COM_KUNENA_POST_EMAIL_NOTIFICATION2' ) : JText::_ ( 'COM_KUNENA_POST_EMAIL_NOTIFICATION2_CAT' ); } else { $msg1 = JText::_ ( 'COM_KUNENA_POST_EMAIL_MOD1' ); $msg2 = JText::_ ( 'COM_KUNENA_POST_EMAIL_MOD2' ); } $msg = "$emailTo->name,\n\n"; $msg .= $msg1 . " " . $this->_config->board_title . "\n\n"; // DO NOT REMOVE EXTRA SPACE, JMailHelper::cleanBody() removes "Subject:" from the message body $msg .= JText::_ ( 'COM_KUNENA_MESSAGE_SUBJECT' ) . " : " . $subject . "\n"; $msg .= JText::_ ( 'COM_KUNENA_GEN_CATEGORY' ) . " : " . $this->parent->catname . "\n"; $msg .= JText::_ ( 'COM_KUNENA_VIEW_POSTED' ) . " : " . $authorname . "\n\n"; $msg .= "URL : $LastPostUrl\n\n"; if ($this->_config->mailfull == 1) { $msg .= JText::_ ( 'COM_KUNENA_GEN_MESSAGE' ) . " :\n-----\n"; $msg .= $message; $msg .= "\n-----\n\n"; } $msg .= $msg2 . "\n"; if ($emailTo->subscription && $once) { if ($this->get ( 'parent' )) { $msg .= JText::_ ( 'COM_KUNENA_POST_EMAIL_NOTIFICATION_MORE_READ' ) . "\n"; } else { $msg .= JText::_ ( 'COM_KUNENA_POST_EMAIL_NOTIFICATION_MORE_SUBSCRIBE' ) . "\n"; } } $msg .= "\n"; $msg .= JText::_ ( 'COM_KUNENA_POST_EMAIL_NOTIFICATION3' ) . "\n"; $msg = JMailHelper::cleanBody ( $msg ); JUtility::sendMail ( $this->_config->email, $mailsender, $emailTo->email, $mailsubject, $msg ); $sentusers[] = $emailTo->id; } if ($once && $sentusers) { $sentusers = implode (',', $sentusers); $db = JFactory::getDBO(); $query = "UPDATE #__kunena_subscriptions SET future1=1 WHERE thread={$this->get ( 'thread' )} AND userid IN ({$sentusers})"; $db->setQuery ($query); $db->query (); KunenaError::checkDatabaseError(); } } }
From this we can see that some of the information is obtained by using PHP variables contained in the language files (for example, COM_KUNENA_GEN_MESSAGE). See Where is the language file? for further information.

Therefore, the solution is to change the source code (that I have shown you above) and to replace the file ../components/kunena/lib/kunena.posting.class.php with your changes together with any changes that you need to make to the language file(s). I've only shown you the general principles; if you do not feel "qualified" to make these changes on your own, I'm sure that (for a modest fee) someone can make them for you ... with the caveats that the changes may need to be reapplied in a selective manner when you upgrade. I hope this information helps.
Last edit: 13 years 8 months ago by sozzled.
The following user(s) said Thank You: miamiman, justmebg

Please Log in or Create an account to join the conversation.

More
12 years 10 months ago #5 by miamiman
Replied by miamiman on topic Modify Email Notification
I want to dress up my email notifications with some basic html, and logo or two.

Where / how to do this?

Any help would be muchly appreciated.

Please Log in or Create an account to join the conversation.

More
12 years 10 months ago #6 by sozzled
The following user(s) said Thank You: miamiman

Please Log in or Create an account to join the conversation.

Time to create page: 0.882 seconds