Obtain $username

hello

how to obtain the username ? the connected user.

many thanks

Use the current_user() function.

<?php 
if ($user = current_user()){
  $name = $user->username;
  $id = $user->id;
  $displayname = $user->name;
  $email = $user->email;
}
?>

https://omeka.readthedocs.io/en/latest/Reference/libraries/globals/current_user.html

great !
many thanks !