WebSite X5Help Center

 
Amjad I.
Amjad I.
User

Any Way to Retrieve username When Logged In  en

Autor: Amjad I.
Besucht 171, Followers 1, Geteilt 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

Gepostet am
2 ANTWORTEN - 1 KORREKT
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

Mehr lesen
Gepostet am von Axel  
Amjad I.
Amjad I.
User
Autor

That was super helpful. Thank you very much.

Mehr lesen
Gepostet am von Amjad I.