mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 04:23:01 +00:00
Add link to avatar upload to user preferences page
This commit is contained in:
parent
1d09c22f3a
commit
9abda2f323
4 changed files with 19 additions and 5 deletions
|
@ -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";
|
||||
|
|
4
core.php
4
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 = [
|
||||
|
|
|
@ -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
|
||||
},
|
||||
{
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue