WebSite X5Help Center

 
Amjad I.
Amjad I.
User

Any Way to Retrieve username When Logged In  en

Автор: Amjad I.
Просмотрено 160, Подписчики 1, Размещенный 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

Размещено
2 Ответы - 1 Корректно
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

Читать больше
Размещено От Axel  
Amjad I.
Amjad I.
User
Автор

That was super helpful. Thank you very much.

Читать больше
Размещено От Amjad I.