From 30aba3e6a782e6a6520ee65c0f39ff82731aad92 Mon Sep 17 00:00:00 2001 From: Laurent Raufaste Date: Sun, 29 Sep 2024 02:41:21 +0200 Subject: [PATCH] Set the scope to also be able to retrieve the user's email Without this, we can't contact anyone for notifications or moderation events. --- bootstrap.inc.php | 4 ++++ include_pouet/pouet-user.php | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/bootstrap.inc.php b/bootstrap.inc.php index ed7fe49..7b0fffa 100644 --- a/bootstrap.inc.php +++ b/bootstrap.inc.php @@ -89,6 +89,10 @@ ) ); } +// Set the scope to also be able to retrieve the user's email. +// Without this, we can't contact anyone for notifications or moderation events. +$sceneID->SetScope(array("basic", "user:email")); + $currentUser = NULL; if (get_login_id()) { diff --git a/include_pouet/pouet-user.php b/include_pouet/pouet-user.php index b6d49ed..051654c 100644 --- a/include_pouet/pouet-user.php +++ b/include_pouet/pouet-user.php @@ -144,7 +144,17 @@ function GetSceneIDData( $cached = true ) try { $sceneID->GetClientCredentialsToken(); - $data = $sceneID->User( $this->id ); + + // If the current user is the same as the PouetUser, get more info from SceneID + if (get_login_id() == $this->id) + { + $data = $sceneID->Me(); + } + else + { + $data = $sceneID->User( $this->id ); + } + if ($data && @$data["user"]) { SQLLib::UpdateRow("users",array(