Add method to parse a supplied User Agent string.#970
Conversation
|
@jamesmills You mentioned earlier that it didn't work for you and you were receiving fatal errors. I did test it when I committed it, but that was 3 months ago and I haven't tried it with the changes implemented in CI since then. Is it working for you now or ? |
|
Hi, I did make a comment and I submitted it and then I realised I was commenting on the wrong post! I was also reading a blog post you had put up saying that you can put this in MY_User_agent.php but if you do that you will get errors because its calling private functions in CI_User_agent.php. I have copied your code into my CI_User_agent.php (it hurt doing it) so that I can use it in one of the projects I am working on at the moment. I spoke to Phil and he said there were issues because it clears the active users info... he also added a comment that in CI3 there will not be a problem adding it to MY_User_agent... Hummmm.... Thanks for the code. Its in a live project and its working well. I will keep my eye on this! James |
|
Yes, I thought about adding a method to reset it so that it will continue to use the current users info instead of the supplied one, but no one seemed interested in this until now so I never got around to it. It did work in MY_User_agent when I wrote it. They might have redeclared some properties/methods since then. I'm glad you find it useful. |
|
Go go go - I need this to. |
|
Because this PR is 2 years old, I took the freedom to implement it myself instead of asking you to make corrections. See the above referenced commit. |
CI has a pretty good user agent parser, but, why limit it to only the current user? There are times where it is useful to be able to parse a string, like processing log files or the user session table, and be able to use the goodness built into this class.