Ok, now let's go ahead and look at a couple of hooks that we can run when a user logs in or logs out. I'm going to switch back to the original user here. And then I'm going to jump back to our module directory.
And in the steps folder, let's open up step four which is called "login-and-logout". Go ahead and copy the code and paste it over the code that's currently in your "persons dot module" file and save it. At the bottom, we've added two functions; "person_user_login" and "person_user_logout".
These are pretty straight forward. This is an implementation of "hook_user_login" and it contains two variables. The first parameter that it's passed is the "edit" variable and this is contains all of the data that was submitted in the user submission form.
So when they logged in, the data that they inputted for the username and password and any other data, will get stored here. And we can manipulate it if we need to. The second parameter is the "account".
And this is the account that got loaded after the user logged in. Now what we're going to do is just display a little message that says whether the user is storing their history or not. We're going to set a default message that will display if the user has set their account to store user history and then if they haven't set that to store history, then we'll display an alternate message which says "You're currently not saving your user history but you can if you got to this page" and the page will be the user account page.