WebSite X5Help Center

 
Amjad I.
Amjad I.
User

Any Way to Retrieve username When Logged In  en

Autor: Amjad I.
Visitado 173, Followers 1, Compartido 0  

Hi everyone,

I used the Login/Logout Plugin and I can see the user's name on the header when he logs in. Does Incomedia has any feature that allows to retrieve the user's name and use it in your code?

Thanks

Publicado en
2 RESPUESTAS - 1 CORRECTO
Axel  
Axel  
User

Hello,

yes you can.

Add an HTML object into your page. Change the html extension of this page by .php extension into page properties. During page creation you need to marlk this page as private

Add this code into your HTML object


<?php
$pa = Configuration::getPrivateArea();
$user = $pa->whoIsLogged();
echo "Bienvenue [realname]: ".$user['realname'];
?>
<br> </br>

<?php
$pa = Configuration::getPrivateArea();
$user = $pa->whoIsLogged();
echo "Bienvenue [username]: ".$user['username'];
?>
<br> </br>

<?php
$pa = Configuration::getPrivateArea();
$user = $pa->whoIsLogged();
echo "Bienvenue [uid]: ".$user['uid'];
?>
<br> </br>

<?php
$pa = new imPrivateArea();
$user = $pa->who_is_logged();
echo "Bienvenue [username] ".$user['username'];
?>
<br> </br>

<?php
$pa = new imPrivateArea();
$user = $pa->who_is_logged();
echo "Bienvenue [email] ".$user['email'];
?>
<br> </br>

<?php
$pa = new imPrivateArea();
$user = $pa->who_is_logged();
echo "Bienvenue [firstname] ".$user['firstname'];
?>
<br> </br>

<?php
$pa = new imPrivateArea();
$user = $pa->who_is_logged();
echo "Bienvenue [lastname] ".$user['lastname'];
?>

And the displaying will be.

Check on my demo : https://wsx5demo.afsoftware.fr/

TAKE CARE: You need to be logged to see the values !

Hope this helps

Axel

Leer más
Publicado en de Axel  
Amjad I.
Amjad I.
User
Autor

That was super helpful. Thank you very much.

Leer más
Publicado en de Amjad I.