diff --git a/plugins/unl_avatars/manifest.xml b/plugins/unl_avatars/manifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..647859f1d0c2e3d9d2e3d96d947651c9ff5674a7 --- /dev/null +++ b/plugins/unl_avatars/manifest.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8"> + <name>UNL Avatars</name> + <author>UNL</author> + <version>1.0</version> + <description>Adds legacy and public Avatar (icon) support</description> + <requires> + <type>elgg_release</type> + <version>2.0</version> + </requires> +</plugin_manifest> diff --git a/plugins/unl_avatars/start.php b/plugins/unl_avatars/start.php new file mode 100644 index 0000000000000000000000000000000000000000..81395d7f1f61d0c9358a3a7e434563e45c6defe6 --- /dev/null +++ b/plugins/unl_avatars/start.php @@ -0,0 +1,28 @@ +<?php + +function unl_avatars_init() { + elgg_register_page_handler('pg', 'unl_avatars_pg_handler'); +} + +// Fire up the plugin initialization using the elgg handler +elgg_register_event_handler('init','system','unl_avatars_init'); + +function unl_avatars_pg_handler($segments) { + if ('icon' != $segments[0]) { + return false; + } + + if (!isset($segments[1], $segments[2])) { + return false; + } + + $username = $segments[1]; + $size = $segments[2]; + + if (!$user = get_user_by_username($username)) { + return false; + } + + //Forward to the new guy + forward('mod/profile/icondirect.php?guid='.$user->guid.'&size='.$size); +}