Welcome Guest, Not a member yet? Register   Sign In
How to display corpname first, if no corpname, then username?
#5

(01-19-2021, 12:19 PM)InsiteFX Wrote: Try this

PHP Code:
<?php if ($this->session->userdata('corp_name'))
{
    echo $this->session->userdata('corp_name');
}
else
{
    echo $this->session->userdata('user_name');
}
?>

If that does not work then your not getting or updating the session correctly.

Thanks @InsiteFX. Your script works but it doesnt work. Firstly I dont yet have a log out feature in our project. If I allow the log in to expire, then log in username, then go direct to advert page it displays the username as expected. And then if I log into a corp & go to the advert it displays the corpname as expected. But if I go back & log into the username again, then to the advert it displays the corpname, probably because the corp has not logged out.

If your script started with a corp log out I think it should work, but I dont know how to do that. We dont want the session destroyed. A user may want to log into more than one corp so each corp login should also start with a log out, but again I dont know how to do that.
Reply


Messages In This Thread
RE: How to display corpname first, if no corpname, then username? - by christaliise - 01-20-2021, 02:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB