12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- function content_subscriptions_create_object_handler($event, $type, ElggObject $object) {
-
- if (!empty($object) && (elgg_instanceof($object, "object", "discussion_reply") || elgg_instanceof($object, "object", "comment"))) {
-
- $owner = $object->getOwnerEntity();
- $entity = $object->getContainerEntity();
-
-
- content_subscriptions_autosubscribe($entity->getGUID(), $owner->getGUID());
- }
- }
- function content_subscriptions_upgrade_system_handler($event, $type, $object) {
-
-
-
- $access_status = access_get_show_hidden_status();
- access_show_hidden_entities(true);
-
-
- $options = array(
- "type" => "user",
- "relationship" => CONTENT_SUBSCRIPTIONS_SUBSCRIPTION,
- "inverse_relationship" => true,
- "count" => true
- );
- $count = elgg_get_entities_from_relationship($options);
- if ($count) {
- $path = "admin/upgrades/content_subscriptions";
- $upgrade = new ElggUpgrade();
- if (!$upgrade->getUpgradeFromPath($path)) {
- $upgrade->setPath($path);
- $upgrade->title = "Content Subscription upgrade";
- $upgrade->description = "The way content subscriptions are handled has changed. Run this script to make sure all content subscriptions are migrated.";
-
- $upgrade->save();
- }
- }
-
- access_show_hidden_entities($access_status);
- }
|