diff --git a/build/index.php b/build/index.php
index a48e653..220d7d2 100644
--- a/build/index.php
+++ b/build/index.php
@@ -1520,7 +1520,7 @@ class page_renderer
 							if(module_exists("feature-user-preferences")) {
 								$result .= "<a href='?action=user-preferences'>$settings->user_preferences_button_text</a>";
 							}
-							$result .= "<a href='?page=" . rawurlencode("$settings->user_page_prefix/$env->user") . "'>" . self::render_username($env->user) . "</a>";
+							$result .= " <a href='?page=" . rawurlencode("$settings->user_page_prefix/$env->user") . "'>" . self::render_username($env->user) . "</a>";
 							$result .= " <small>(<a href='index.php?action=logout'>Logout</a>)</small>";
 							$result .= "</span>";
 							//$result .= page_renderer::$nav_divider;
@@ -1729,7 +1729,7 @@ function add_action($action_name, $func)
 function has_action($action_name)
 {
 	global $actions;
-	return !empty($actions->action_name);
+	return !empty($actions->$action_name);
 }
 
 $parsers = [
@@ -4480,6 +4480,13 @@ register_module([
 			{
 				$content .= "<p class='user-prefs-status-message'><em>" . $statusMessages[$_GET["operation"]] . "</em></p>\n";
 			}
+			// If avatar support is present, allow the user to upload a new avatar
+			if(has_action("avatar") && module_exists("feature-upload")) {
+				$content .= "<a href='?action=upload&avatar=yes' class='preview'><figure>\n";
+				$content .= "\t<img class='avatar' src='?action=avatar&user=" . urlencode($env->user) . "&size=256' title='Your current avatar - click to upload a new one' />\n";
+				$content .= "<figcaption>Upload a new avatar</figcaption>\n";
+				$content .= "</figure></a><br />\n";
+			}
 			$content .= "<label for='username'>Username:</label>\n";
 			$content .= "<input type='text' name='username' value='$env->user' readonly />\n";
 			$content .= "<form method='post' action='?action=save-preferences'>\n";
diff --git a/core.php b/core.php
index e9d018b..b8567b6 100644
--- a/core.php
+++ b/core.php
@@ -1171,7 +1171,7 @@ class page_renderer
 							if(module_exists("feature-user-preferences")) {
 								$result .= "<a href='?action=user-preferences'>$settings->user_preferences_button_text</a>";
 							}
-							$result .= "<a href='?page=" . rawurlencode("$settings->user_page_prefix/$env->user") . "'>" . self::render_username($env->user) . "</a>";
+							$result .= " <a href='?page=" . rawurlencode("$settings->user_page_prefix/$env->user") . "'>" . self::render_username($env->user) . "</a>";
 							$result .= " <small>(<a href='index.php?action=logout'>Logout</a>)</small>";
 							$result .= "</span>";
 							//$result .= page_renderer::$nav_divider;
@@ -1380,7 +1380,7 @@ function add_action($action_name, $func)
 function has_action($action_name)
 {
 	global $actions;
-	return !empty($actions->action_name);
+	return !empty($actions->$action_name);
 }
 
 $parsers = [
diff --git a/module_index.json b/module_index.json
index f17dbce..a22594a 100755
--- a/module_index.json
+++ b/module_index.json
@@ -113,7 +113,7 @@
         "author": "Starbeamrainbowlabs",
         "description": "Adds a user preferences page, letting pople do things like change their email address and password.",
         "id": "feature-user-preferences",
-        "lastupdate": 1497713836,
+        "lastupdate": 1497791119,
         "optional": false
     },
     {
diff --git a/modules/feature-user-preferences.php b/modules/feature-user-preferences.php
index 0782eb8..54e37c1 100644
--- a/modules/feature-user-preferences.php
+++ b/modules/feature-user-preferences.php
@@ -49,6 +49,13 @@ register_module([
 			{
 				$content .= "<p class='user-prefs-status-message'><em>" . $statusMessages[$_GET["operation"]] . "</em></p>\n";
 			}
+			// If avatar support is present, allow the user to upload a new avatar
+			if(has_action("avatar") && module_exists("feature-upload")) {
+				$content .= "<a href='?action=upload&avatar=yes' class='preview'><figure>\n";
+				$content .= "\t<img class='avatar' src='?action=avatar&user=" . urlencode($env->user) . "&size=256' title='Your current avatar - click to upload a new one' />\n";
+				$content .= "<figcaption>Upload a new avatar</figcaption>\n";
+				$content .= "</figure></a><br />\n";
+			}
 			$content .= "<label for='username'>Username:</label>\n";
 			$content .= "<input type='text' name='username' value='$env->user' readonly />\n";
 			$content .= "<form method='post' action='?action=save-preferences'>\n";
