View Full Version : Display Browser Information?
Gene Steinberg
07-17-2008, 10:58 PM
I did a search of the usual text strings here and failed to turn up anything.
Is there an add-on/hack/whatever that allows you to display information about what browser/OS the member is using as part of the information that's displayed in their messages?
I'd want a vBulletin 3.7x compatible solution.
Anyone?
Dismounted
07-18-2008, 06:58 AM
You can use the user agent string - but don't trust it.
Gene Steinberg
07-18-2008, 07:52 AM
You can use the user agent string - but don't trust it.
What and how?
Dismounted
07-18-2008, 09:07 AM
You'll need some knowledge of PHP - if you do, Googling "user agent string php" will probably reveal some code examples.
Gene Steinberg
07-18-2008, 10:51 AM
You'll need some knowledge of PHP - if you do, Googling "user agent string php" will probably reveal some code examples.
The reason I posted it here was to get just that information and the best way to implement it in vBulletin.
Anyone here want to really help me?
--------------- Added 1216398110 at 1216398110 ---------------
I do have some code now that I got online, as follows:
<?php
echo ( browser_detection( 'number' ) .'<br>'.
browser_detection( 'browser' ) .'<br>'.
browser_detection( 'os' ) .'<br>'.
browser_detection( 'os_number' ) );
?>
Outputs (browser version, browser, os, os number):
1.5
moz
nt
5.1
<?php
if ( ( browser_detection( 'browser' ) == 'ie' )
&&
( browser_detection( 'number' ) >= 5 ) )
{
echo 'it is Internet Explorer ' .
browser_detection( 'number' );
// or anything else you want to happen of course
}
?>
OK, this goes in a postbit template? Which one? Where?
Will it do what I want?
Dismounted
07-19-2008, 03:59 AM
Yuou cannot run PHP code in templates - yo need run PHP code in plugins. And furthermore - you need to capture this data as the user browses the website and store it. You cannot simply plonk that code in postbit and have the information magically appear for everyone.
Gene Steinberg
07-19-2008, 03:14 PM
Yuou cannot run PHP code in templates - yo need run PHP code in plugins. And furthermore - you need to capture this data as the user browses the website and store it. You cannot simply plonk that code in postbit and have the information magically appear for everyone.
So, then, when you implied otherwise in your original message, that wasn't quite correct. OK.
So how do we do it then. Anyone want to provide assistance rather than give me two sides of the coin?
RLShare
07-19-2008, 04:00 PM
How did he imply anything. He stated you can use the user agent string to grab the data. WHICH IS TRUE. But you cannot simultaniously grab useragents of all people that have ever browsed the website and magically send them to all other people browsing the website to have them show up in the postbit. The data you gather needs to be stored somewhere so you can retrieve it to display later.
Gene Steinberg
07-19-2008, 04:36 PM
He said I should look on the Internet to find the PHP code, then said it wouldn't work as I wanted it to. I understand the limits.
How about a solution instead of an insult?
RLShare
07-19-2008, 04:48 PM
How is anyone insulting you?
Pointing out that what he said was right is insulting you?
How much more help do you want?
Write a plugin that gathers the info as the user is browsing the website and stores it in the database, write another plug-in that retrieves the data and display it accordingly.
Opserty
07-19-2008, 04:48 PM
Why not just create a Custom "User Profile Field", allow users to select their browser and then display that in postbit?
For Part 1: Check the AdminCP side Menu
For Part 2: see this thread add info to the right? (https://vborg.vbsupport.ru/showthread.php?t=185633)
Gene Steinberg
07-19-2008, 06:47 PM
Why not just create a Custom "User Profile Field", allow users to select their browser and then display that in postbit?
For Part 1: Check the AdminCP side Menu
For Part 2: see this thread add info to the right? (https://vborg.vbsupport.ru/showthread.php?t=185633)
Good suggestion.
How about, though, being able to just add something that does this automatically? I know I had something of that sort with SMF way back when -- and certainly vBulletin is far more advanced than that. :)
--------------- Added 1216498056 at 1216498056 ---------------
Good suggestion.
How about, though, being able to just add something that does this automatically? I know I had something of that sort with SMF way back when -- and certainly vBulletin is far more advanced than that. :)
I just wanted to add, Opserty, that I really appreciate your assistance. I did add this extra User CP option to our two vBulletin forums (we're about to spring for another license shortly) with the appropriate mods in the postbit template, and a tiny bit of customization. I'm not completely helpless. Well, make it mostly helpless. :D
But I'm still tempted by the possibilities of an intelligent user agent too if anyone wishes to contribute.
Paul M
07-19-2008, 07:17 PM
vbulletin has a function called is_browser() which has a lot of browser detection code in it - its in functions.php if you want to look at it.
Gene Steinberg
07-19-2008, 07:25 PM
vbulletin has a function called is_browser() which has a lot of browser detection code in it - its in functions.php if you want to look at it.
When we start getting deep and dirty into the code, you will lose me fast.
Care to suggest a way to implement this automatically in postbit? I can replace the optional field and use that, if I had guidance and such, and perhaps a few options. :)
I think I'm good at building a popular forum (see http://forum.theparacast.com and decide for yourself). I can assemble useful mods, customize them and I think I did a decent job with the default theme to turn it to our purposes and style. But for the rest, I can always use step-by-step assistance.
Thanks for the direction, though. :)
Opserty
07-19-2008, 07:34 PM
Unfortunately if you don't have experience with PHP then you will have to make a modification request and hope someone will take up the request.
We can give you guidance but we can't sit here and write the code out for you.
If you want to store it on a per user basis, you'd need to something like the following:
1. Extend the User Table
2. Extend the User DataManager
3. Fetch the Users Browser using the PHP Code and compare this to the one already stored.
4. If its different, then update the user table
5. Add the new "User" field into the postbit template using the $post array.
Gene Steinberg
07-19-2008, 07:43 PM
Honestly, I thought that was the purpose of my messages, to request just that sort of assistance. :)
Dismounted
07-20-2008, 05:29 AM
He said I should look on the Internet to find the PHP code, then said it wouldn't work as I wanted it to. I understand the limits.
It would work how you wanted it to, but you were not going about the correct way of "thinking".
The purpose of this forum is to discuss programming, and to provide guidance, the forum you are looking for is: Modification Requests (https://vborg.vbsupport.ru/forumdisplay.php?f=112).
Gene Steinberg
07-20-2008, 04:43 PM
It would work how you wanted it to, but you were not going about the correct way of "thinking".
The purpose of this forum is to discuss programming, and to provide guidance, the forum you are looking for is: Modification Requests (https://vborg.vbsupport.ru/forumdisplay.php?f=112).
Well, if it would work, then perhaps someone would clue me in on what to do next.
If you know, don't hold back. :)
I did post something in Modification Requests, but that came later. I had presumed there were existing solutions already available for vBulletin.
Dismounted
07-21-2008, 05:49 AM
Create a field in the user table to store the user agent. Then at global_start, parse and record the user agent. Use that data in your postbit.
That's the solution, how you code it, is your decision. Again - we are not here to code every bit of code you need, we provide guidance.
Gene Steinberg
07-21-2008, 12:12 PM
Create a field in the user table to store the user agent. Then at global_start, parse and record the user agent. Use that data in your postbit.
That's the solution, how you code it, is your decision. Again - we are not here to code every bit of code you need, we provide guidance.
And what is there about all this that prevents you from providing the snippet of code that I can put in postbit to resolve this?
Dismounted
07-21-2008, 12:20 PM
It's more than just "a snippet of code in postbit"... I wish everything was that simple.
Gene Steinberg
07-21-2008, 12:23 PM
It's more than just "a snippet of code in postbit"... I wish everything was that simple.
Well that certainly helps -- not!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.