Identifying users browser?

Identifying users browser?

by John Stevens -
Number of replies: 8
Anybody have a way of Identifying a users type and version of browser they are using within moodle?

John
Average of ratings: -
In reply to John Stevens

Re: Identifying users browser?

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Do you have access to your web server logs? These will give you all the info you need about client browsers...
In reply to Jon Witts

Re: Identifying users browser?

by John Stevens -
and we are logging this in the server logs now, so we have that at least.
In reply to John Stevens

Re: Identifying users browser?

by Dale Davies -
Not sure if there is anything built into Moodle, but you could either do it using javascript or PHP, see the following...


Javascript:
http://www.quirksmode.org/js/detect.html

PHP:
http://chrisschuld.com/projects/browser-php-detecting-a-users-browser-from-php/


Other solutions include using jQuery (Javascript), HTML conditional comments and even pure CSS (using hacks such as adding a * before the selector).
In reply to John Stevens

Re: Identifying users browser?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
As a matter of interest... why would you want to do such a thing (in a Moodle context anyway)?
In reply to Howard Miller

Re: Identifying users browser?

by Dale Davies -
Oh, forgot you wanted the users type too. I use seperate authentication plugins for this.

So for example... We use LDAP authentication for both teachers and students, to identify who is a teacher and who is a student I have an LDAP Auth plugin called "ldap" (the original plugin) looking at certain OU's in our Active Directory and one called "ldapstaff" (a copy of the original) looking at different OU's.

When I need to identify one type of user from the other (e.g. on the My Moodle page to display different/relavent info) I use...


if ($USER->auth == 'ldap') {

// Do something for students...

} else if ($USER->auth == 'ldapstaff') {

// Do something for staff...

}


Howard: I was wondering that too, especially in the context of this forum as the only answers I can give would be better suited to the General Developers forum (sorry).
In reply to Dale Davies

Re: Identifying users browser?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Not to worried about the forum... just wondered what is at the bottom of this. It's a very specific request and, I suspect, may lead to something truly terrible tongueout
In reply to Howard Miller

Re: Identifying users browser?

by John Stevens -
We have had problems with the quiz module in secure mode and users using different browsers. I want a way to know which user was using what browser so I could identify the troublesome ones. I was hoping for a in Moodle solution.
In reply to John Stevens

Re: Identifying users browser?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
The web server logs are probably the way to go.

The BEST advice is probably to find a way not to have to use quiz secure mode, however. That's never going to be entirely satisfactory. Unfortunately, that usually entails committing a large chunk of your life to writing hundreds of questions (you can always get the students to write them for you though!!).

If you get some useful data don't forget to let us know smile