modification pour afficher user par pseudo et non par id

This commit is contained in:
Yasder5 2026-02-19 21:10:24 +01:00
parent 190554d966
commit b11f67793a
9 changed files with 47 additions and 25 deletions

View file

@ -151,7 +151,7 @@ class UserCtrl extends MotherCtrl {
*/
public function user(){
$intId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
/**$intId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
if ($intId <= 0) {
header("Location: index.php");
@ -162,16 +162,27 @@ class UserCtrl extends MotherCtrl {
$objUserModel = new UserModel;
$arrUserData = $objUserModel->findUserById($intId);
if ($arrUserData === false) {
header("Location: index.php");
exit;
}*/
$strPseudo = $_GET['pseudo']??'';
$objUserModel = new UserModel;
$arrUserData = $objUserModel->findUserByPseudo($strPseudo);
if ($arrUserData === false) {
header("Location: index.php");
exit;
}
$objUser = new User;
$objUser->hydrate($arrUserData);
//affichage projet de l'utilisateur
$objProjectModel = new ProjectModel;
$arrProjects = $objProjectModel->findAll(0,'',$intId);
$arrProjects = $objProjectModel->findAll(0,'',$objUser->getId());
$arrProjectToDisplay = array();
foreach($arrProjects as $projectData) {