Add bio field to getprofile
This commit is contained in:
parent
e47cc7342f
commit
8b349fd0ea
@ -7,13 +7,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (empty($VARS["id"])) {
|
if (empty($VARS["id"])) {
|
||||||
$profile = $database->get("accounts", ["[>]authkeys" => ["accountid"]], ["publicid", "name", "username", "type", "verified"], ["key" => $VARS["key"]]);
|
$profile = $database->get("accounts", ["[>]authkeys" => ["accountid"]], ["publicid", "name", "username", "type", "verified", "bio"], ["key" => $VARS["key"]]);
|
||||||
} else {
|
} else {
|
||||||
if (!$database->has("accounts", ["publicid" => $VARS["id"]])) {
|
if (!$database->has("accounts", ["publicid" => $VARS["id"]])) {
|
||||||
sendJsonResp($Strings->get("Could not find a matching account.", false), "ERROR");
|
sendJsonResp($Strings->get("Could not find a matching account.", false), "ERROR");
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile = $database->get("accounts", ["publicid", "name", "username", "type", "verified"], ["publicid" => $VARS["id"]]);
|
$profile = $database->get("accounts", ["publicid", "name", "username", "type", "verified", "bio"], ["publicid" => $VARS["id"]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the name field always has something useful
|
// Make sure the name field always has something useful
|
||||||
@ -21,6 +21,10 @@ if (empty($profile["name"])) {
|
|||||||
$profile["name"] = $profile["username"];
|
$profile["name"] = $profile["username"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($profile["bio"])) {
|
||||||
|
$profile["bio"] = "";
|
||||||
|
}
|
||||||
|
|
||||||
$profile["verified"] = $profile["verified"] == 1;
|
$profile["verified"] = $profile["verified"] == 1;
|
||||||
|
|
||||||
exitWithJson([
|
exitWithJson([
|
@ -60,7 +60,7 @@ $APIS = [
|
|||||||
]
|
]
|
||||||
],
|
],
|
||||||
"getprofile" => [
|
"getprofile" => [
|
||||||
"load" => "profile.php",
|
"load" => "getprofile.php",
|
||||||
"vars" => [
|
"vars" => [
|
||||||
"key" => $keyregex,
|
"key" => $keyregex,
|
||||||
"id (optional)" => "/[0-9a-z]+/"
|
"id (optional)" => "/[0-9a-z]+/"
|
||||||
|
BIN
database.mwb
BIN
database.mwb
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user