Skip to content

Commit 9362135

Browse files
committed
Allow steam username or id in profile
1 parent 0ea9c6c commit 9362135

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/controllers/User/Update.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function &run(Router &$router, View &$view, array &$args) {
118118
);
119119

120120
$model->steam_id = (
121-
isset($data['steam_id']) ? (int) $data['steam_id'] : null
121+
isset($data['steam_id']) ? $data['steam_id'] : null
122122
);
123123

124124
$model->twitter_username = (

src/libraries/UserProfile.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,12 @@ public function getSteamId() {
119119
}
120120

121121
public function getSteamURI() {
122-
return "https://steamcommunity.com/profiles/" . $this->getSteamId();
122+
$steam = $this->getSteamId();
123+
if (is_numeric($steam)) {
124+
return "https://steamcommunity.com/profiles/" . $steam;
125+
} else {
126+
return "https://steamcommunity.com/id/" . $steam;
127+
}
123128
}
124129

125130
public function getTwitterURI() {
@@ -155,7 +160,6 @@ public function getWebsiteURI() {
155160

156161
protected static function normalize(StdClass &$data) {
157162
$data->user_id = (int) $data->user_id;
158-
$data->steam_id = (int) $data->steam_id;
159163

160164
if (!is_null($data->biography))
161165
$data->biography = (string) $data->biography;
@@ -181,6 +185,9 @@ protected static function normalize(StdClass &$data) {
181185
if (!is_null($data->twitter_username))
182186
$data->twitter_username = (string) $data->twitter_username;
183187

188+
if (!is_null($data->steam_id))
189+
$data->steam_id = (string) $data->steam_id;
190+
184191
if (!is_null($data->website))
185192
$data->website = (string) $data->website;
186193

0 commit comments

Comments
 (0)