name !== 'likes') { // not likes return; } $entity = $annotation->getEntity(); if (empty($entity) || !($entity instanceof \ElggEntity)) { return; } $user = $annotation->getOwnerEntity(); if (empty($user) || !($user instanceof \ElggUser)) { return; } if (!content_subscriptions_can_subscribe($entity, $user->getGUID())) { // subscribing isn't allowed for this entity type/subtype return; } // auto subscribe to this entity content_subscriptions_autosubscribe($entity->getGUID(), $user->getGUID()); } /** * Is auto subscribe enabled for Likes * * @return bool */ protected static function autoSubscribe() { if (isset(self::$autosubscribe)) { return self::$autosubscribe; } self::$autosubscribe = false; $setting = elgg_get_plugin_setting('likes_autosubscribe', 'content_subscriptions'); if ($setting === 'yes') { self::$autosubscribe = true; } return self::$autosubscribe; } }