aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/entities.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 8784e9af4..9ddb4c9f1 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -763,6 +763,37 @@
return $returnvalue;
}
+ /**
+ * Import an entity.
+ * This function checks the passed XML doc (as array) to see if it is a user, if so it constructs a new
+ * elgg user and returns "true" to inform the importer that it's been handled.
+ */
+ function import_entity_plugin_hook($hook, $entity_type, $returnvalue, $params)
+ {
+ $name = $params['name'];
+ $element = $params['element'];
+
+ $tmp = NULL;
+
+ switch ($name)
+ {
+ case 'ElggUser' : $tmp = new ElggUser(); break;
+ case 'ElggSite' : $tmp = new ElggSite(); break;
+ case 'ElggConnection' : $tmp = new ElggConnection(); break;
+ case 'ElggObject' : $tmp = new ElggObject(); break;
+ }
+
+ if ($tmp)
+ {
+ $tmp->import($element);
+
+ return $tmp;
+ }
+ }
+
+ /** Register the import hook */
+ register_plugin_hook("import", "all", "import_user_plugin_hook", 0);
+
/** Register the hook, ensuring entities are serialised first */
register_plugin_hook("export", "all", "export_entity_plugin_hook", 0);