Skip to content

Commit da3347f

Browse files
committed
fixed: question owner not notified when using content subscriptions
fixes #9
1 parent dae9a90 commit da3347f

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

classes/ColdTrick/Questions/Notifications.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,25 @@ public static function addQuestionOwnerToAnswerSubscribers($hook, $type, $return
307307
return;
308308
}
309309

310-
$answer = $event->getObject();
311-
if (!($answer instanceof \ElggAnswer)) {
310+
$object = $event->getObject();
311+
if (!($object instanceof \ElggObject)) {
312+
return;
313+
}
314+
315+
$question = false;
316+
$container = $object->getContainerEntity();
317+
if ($object instanceof \ElggAnswer) {
318+
$question = $container;
319+
} elseif ($container instanceof \ElggAnswer) {
320+
// comments on answers
321+
$question = $container->getContainerEntity();
322+
}
323+
324+
if (!($question instanceof \ElggQuestion)) {
325+
// something went wrong, maybe access
312326
return;
313327
}
314328

315-
$question = $answer->getContainerEntity();
316329
$owner = $question->getOwnerEntity();
317330

318331
$methods = get_user_notification_settings($owner->getGUID());

0 commit comments

Comments
 (0)