1

I am using tiki version 15.3 I setup my preference that if there is a new forum thread that I am an editor, I will receive an email notification in "My Watches". However, I haven't received any email. It works for blog and new user registration though. So no problem with the email setup. As I debug the code, I found a few problem in the code: In File: /lib/notification/notificationemaillib.php Line: 112

$nots_raw = $tikilib->get_event_watches($event, $event == 'forum_post_topic'? $forum_info['forumId']: $threadId, $forum_info);

Should the $threadId is the $parentId? Since the Tiki_user_Watch table store the Thread Parent Id not the newly created threadId. Secondly,

In line 122:

foreach ( $nots_raw as $n ) {
        if ($n['user'] != $author
                && !in_array($n['user'], $users)) {
            // make sure user receive only one notification even if he is monitoring both the topic and thread
            $n['language'] = $tikilib->get_user_preference($n['user'], "language", $defaultLanguage);
            $nots[] = $n;
            $users[] = $n['user'];
        }

There is no else for this if clause. I understand this condition is to send only 1 email when user monitor both thread and topic. However, I am monitoring only 1 of them, I think there should be an"

else{ $nots[] = $n;}

This way the $nots will have something to send email in the later part of the code.

if (count($nots)) {
    include_once('lib/webmail/tikimaillib.php');
    $smarty->assign('mail_forum', $forum_info["name"]);...

Please advise if I am wrong.

Tommy
  • 31
  • 3

1 Answers1

0

You are correct. I believe I have fixed it with this commit, which will be in the next release of version 15 (also committed to version 16, 17 and trunk).

The parent ID needed to be used instead of the thread ID as you pointed out (thanks for that - made it much easier with most of the debugging already done!). There was also an issue with identifying the existing watches properly. I don't think the if statement needs an else, but let me know if this doesn't fix it for you.

lindon
  • 654
  • 8
  • 19