By Mark H on Sunday, 27 April 2014
Posted in General Issues
Replies 8
Likes 0
Views 1.2K
Votes 0
Hi,

I would like to add another button to the "New Reply" notification emails.

The existing button, "Read this discussion" takes you to the start of the topic, which is fine. However, I'd like a second button which links to the actual post the notification is telling the user about.

E.g., the "Read this discussion" button points to:

http://www.domain.com/forum/topic

I want the second button to link to the #permalink:

http://www.domain.com/forum/topic#reply-20

Please can you tell me which files I need to edit and what I would need to add to construct this URL?
Hello Mark,

This is currently not possible because the variables for the "reply" item aren't exposed to the theme files. We'll try to see if we can add this in the future.
·
Sunday, 27 April 2014 22:49
·
0 Likes
·
0 Votes
·
0 Comments
·
Ok, thanks Mark.

It would be good for here too, as I'm following some very long threads and am often viewing on my phone, which makes for a lot of scrolling!
·
Sunday, 27 April 2014 23:36
·
0 Likes
·
0 Votes
·
0 Comments
·
Mark H wrote:

Ok, thanks Mark.

It would be good for here too, as I'm following some very long threads and am often viewing on my phone, which makes for a lot of scrolling!

+ (I join a question!)
Please can you tell me which files I need to edit and what I would need to add to construct this URL?

/components/com_easydiscuss/helpers/router.php
(for SEF - line: 568)
Hope this helps.
PS: Now I will explore the possibility of anchor links...
·
Monday, 28 April 2014 07:39
·
0 Likes
·
0 Votes
·
0 Comments
·
Currently the email template for replies are not exposed to the reply object so you can't really get the reply id. There are several files that you would need to hack in order to achieve this.
·
Monday, 28 April 2014 12:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Evgeniy wrote:
/components/com_easydiscuss/helpers/router.php
(for SEF - line: 568)
Hope this helps.
PS: Now I will explore the possibility of anchor links...


Thank you, that helps a lot!

Please reply if you work out how to add the anchor.
·
Monday, 28 April 2014 13:00
·
0 Likes
·
0 Votes
·
0 Comments
·
PS: Now I will explore the possibility of anchor links...


Anchor (#) in URL's e-mail notifications.

File: /components/com_easydiscuss/views/post/view.ajax.php

Lines: 1283, 1312

Search:
'permalink' => 'index.php?option=com_easydiscuss&view=post&id=' . $question->get( 'id' )

Change (append):
'permalink' => 'index.php?option=com_easydiscuss&view=post&id=' . $question->get( 'id' ).'#'.JText::_('COM_EASYDISCUSS_REPLY_PERMALINK').'-'.$table->id



Line: 1470

Search:
$emailData['postLink']

Change:
$emailData['postLink']      = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $parent->id.'#'.JText::_('COM_EASYDISCUSS_REPLY_PERMALINK').'-'.$table->id, false, true);


and in SEF-section:

File: /components/com_easydiscuss/helpers/router.php:

Search:
    if( DiscussRouter::isSefEnabled() )

in this section locate:
			if( DiscussRouter::isSefEnabled() )
{
$container = explode('/', $url);
$container = array_unique($container);
$url = implode('/', $container);
}

replace:
			if( DiscussRouter::isSefEnabled() )
{
$container = explode('/', $url);
$container = array_unique($container);


foreach ($container as $k=>$c) {
if ($k>0) {
if (strpos($c,'#')!==false) {
$c=explode('#',$c,2);
$container[$k]=urlencode($c[0]).'#'.urlencode($c[1]);
} else $container[$k]=urlencode($c);
}
}

$url = implode('/', $container);
}


After changes - anchors work fine.
·
Monday, 28 April 2014 14:16
·
0 Likes
·
0 Votes
·
0 Comments
·
Wow, you're the man / woman!

Thank you so much, I will be trying this.

Mark, if this works, please can you incorporate it into the product and perhaps on here too? It would make it much more pleasurable to work with long topics.
·
Monday, 28 April 2014 17:05
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for sharing We will consider this in the future
·
Monday, 28 April 2014 17:13
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post