Skip to content
Snippets Groups Projects
Commit 9b3dc5a2 authored by Michael Fairchild's avatar Michael Fairchild
Browse files

Also handle legacy profile urls

parent 82fa26a6
No related branches found
No related tags found
4 merge requests!15WIP: Support WDN version 5.3,!8Update for elgg upgrade,!3Develop,!1Git fixes
......@@ -8,10 +8,22 @@ function unl_avatars_init() {
elgg_register_event_handler('init','system','unl_avatars_init');
function unl_avatars_pg_handler($segments) {
if ('icon' != $segments[0]) {
if (!isset($segments[0])) {
return false;
}
if ('profile' == $segments[0]) {
return unl_avatars_pg_profile($segments);
}
if ('icon' == $segments[0]) {
return unl_avatars_pg_icon($segments);
}
return false;
}
function unl_avatars_pg_icon($segments) {
if (!isset($segments[1], $segments[2])) {
return false;
}
......@@ -20,9 +32,18 @@ function unl_avatars_pg_handler($segments) {
$size = $segments[2];
if (!$user = get_user_by_username($username)) {
//The legacy behavior was to return the default image rather than a 404
forward(elgg_get_simplecache_url("icons/user/default{$size}.gif"));
}
//Forward to the new guy
forward('mod/profile/icondirect.php?guid='.$user->guid.'&size='.$size);
}
function unl_avatars_pg_profile($segments) {
if (!isset($segments[1])) {
return false;
}
forward('profile/'.$segments[1]);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment