Welcome Guest, Not a member yet? Register   Sign In
Getting User ID from Redux Auth
#11

[eluser]Dam1an[/eluser]
[quote author="Timothy_" date="1243365063"]Dam1an, You are obviously an expert.[/quote]
If I'm an expert with code I've only spent a minute familiarising myself with, just imagine what I'm like with code I actually know Wink

Its expected to look like that in the database
if you look at how the session class works (this based on what I remember when I last looked into it, so it may be a bit off) you'll see the userdata (and flashdata) arrays get serielized at the end of the http request and written to the database, on the next httprequest, the whole string is read from the database and unserialized back into the arrays.
What this means to you, is you can call it as you would normally, i.e:
Code:
$user_id = $this->session->userdata('user_id');
#12

[eluser]Timothy_[/eluser]
Dam1an,

It works!!

I cant thank you enough. ive spent so many hours on this and its so good to get help from people who really know what they are doing.

Im off to catch up on some much needed sleep, I hope you have a great day!

Tim
#13

[eluser]Dam1an[/eluser]
Your welcome Smile
Now that you're sleep deprived due to coding, you're officially a developer Wink
#14

[eluser]Devon Lambert[/eluser]
@ Dam1an: This seems to be the perfect solution in the short term, but what about getting other user fields back from the database?

Does it make sense, from a security AND performance perspective, to store all of the userdata values that may be necessary later in the session table?

OR should we create a few new methods within the auth model to handle the retrieval of these values?
#15

[eluser]Dam1an[/eluser]
I don't recall suggesting storing all the user data in the session data, just the user_id
Using the ID you can easily lookup anything you want (yes you could do a lookup on the email as that'll be unique, but I'm assuming an integer lookup will be faster)

And you're more then welcome to add methods to get extra user info if you want (and thats what I do in my apps, a lookup based on the user_id)
#16

[eluser]Devon Lambert[/eluser]
Good call.

Thanks for the feedback. :-)




Theme © iAndrew 2016 - Forum software by © MyBB