Hi there
Here is my approach to this issue–a bit simpler I'd say…
User data are traditionally session data, so I'd go into:
system/library/customer.php ~line 30 and just add this
Code: Select all
### AddedHack: get something in the Session on login
$this->session->data['myAddedSessVar__customerFirstName'] = $customer_query->row['firstname'];
# or do this if you want
$this->session->data['myAddedSessVar__customerWelcome'] = "Welcome back ".$customer_query->row['firstname'];
(
I use this long naming so I don't run into problems in the Variables Scope)
To make sure the session data is destroyed when logging of I add
line~120
Code: Select all
### AddedHack: do a session destroy on logout
session_destroy();
Here I don't understand why Daniel uses this approach with unsetting individual vars
Code: Select all
unset($this->session->data['customer_id']);
And now place this anywhere you want in your layout template
Code: Select all
<?php echo $this->session->data['myAddedSessVar__customerFirstName'];
Code: Select all
<?php echo $this->session->data['myAddedSessVar__customerWelcome'];
and it will be displayed during the entire logged in session.
This is an example so you get the idea… there is room for variation…
@halalan
I'm totally with you on how things would better be placed in the core or as extensions and I understand your frustration…
Hacks become painful when upgrading, so I'll try to keep it simple and always have my "### AddedHack:" ;-)
cheers