getOwnerEntity(); $question = $object->getContainerEntity(); if (!content_subscriptions_can_subscribe($question, $owner->getGUID())) { return; } // subscribe to the question content_subscriptions_autosubscribe($question->getGUID(), $owner->getGUID()); } /** * Subscribe to a question when you create a comment on an answer * * @param string $event * @param string $type * @param \ElggObject $object * * @return void */ public static function createCommentOnAnswer($event, $type, \ElggObject $object) { if (!elgg_is_active_plugin('content_subscriptions')) { return; } if (!($object instanceof \ElggComment)) { return; } $answer = $object->getContainerEntity(); if (!($answer instanceof \ElggAnswer)) { return; } $owner = $object->getOwnerEntity(); $question = $answer->getContainerEntity(); if (!content_subscriptions_can_subscribe($question, $owner->getGUID())) { return; } // subscribe to the question content_subscriptions_autosubscribe($question->getGUID(), $owner->getGUID()); } }