vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Display Browser Information? (https://vborg.vbsupport.ru/showthread.php?t=185638)

Gene Steinberg 07-17-2008 10:58 PM

Display Browser Information?
 
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

Quote:

Originally Posted by Dismounted (Post 1578227)
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

Quote:

Originally Posted by Dismounted (Post 1578304)
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 [DATE]1216398110[/DATE] at [TIME]1216398110[/TIME] ---------------

I do have some code now that I got online, as follows:

PHP Code:

<?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' ) >= ) )
{
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

Quote:

Originally Posted by Dismounted (Post 1578848)
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?

Gene Steinberg 07-19-2008 06:47 PM

Quote:

Originally Posted by Opserty (Post 1579171)
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?

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 [DATE]1216498056[/DATE] at [TIME]1216498056[/TIME] ---------------

Quote:

Originally Posted by genesteinberg (Post 1579278)
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

Quote:

Originally Posted by Paul M (Post 1579299)
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

Quote:

Originally Posted by genesteinberg (Post 1579157)
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.

Gene Steinberg 07-20-2008 04:43 PM

Quote:

Originally Posted by Dismounted (Post 1579590)
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.

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

Quote:

Originally Posted by Dismounted (Post 1580358)
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

Quote:

Originally Posted by Dismounted (Post 1580545)
It's more than just "a snippet of code in postbit"... I wish everything was that simple.

Well that certainly helps -- not!


All times are GMT. The time now is 03:44 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01221 seconds
  • Memory Usage 1,791KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (22)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete