complete plugin rewrite for Elgg 1.9