vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Miscellaneous Hacks - Digital Point User Map (https://vborg.vbsupport.ru/showthread.php?t=244236)

digitalpoint 06-08-2010 10:00 PM

Digital Point User Map
 
1 Attachment(s)
About
This is a system for geo-locating your currently online users and plotting them on a world Google Map. You can click any of the pins for a link to pull up the user's location in Google Earth.

This is something I originally made almost 5 years ago. Now that I rewrote it for vBulletin 4, I wrapped it up as a product package and released it for the world to use.

Installation
  • Put the usermap.php file in your forum folder.
  • Install the product-digitalpoint_usermap.xml product under AdminCP -> Plugins & Products -> Manage Products -> Add/Import Product
Notes
  • Important! - this uses the free GeoIP PHP extension, so you must have it installed on your server in order for it to work.
  • Uses datastore cache so it does not repeat GeoIP queries unnecessarily.
  • Upgraded to Google Maps API v3.
You can see a live version in action here:
http://forums.digitalpoint.com/usermap.php

noppid 06-08-2010 10:03 PM

Nice to see. Thanks!

Reeve of shinra 06-09-2010 12:02 AM

Cool beans!

Trek 06-09-2010 12:16 AM

Thanks much, installed!

*edit*

nm, can't use it. My webhost doesn't have the PHP extension required for this mod. Had to uninstall.

karlm 06-09-2010 01:04 AM

Looks awesome... will investigate further soon..

digitalpoint 06-09-2010 02:09 AM

Quote:

Originally Posted by Trek (Post 2050750)
Thanks much, installed!

*edit*

nm, can't use it. My webhost doesn't have the PHP extension required for this mod. Had to uninstall.

Yeah, sorry... I knew that was going to be the biggest sticking point, but it *is* a fairly common PHP extension so some people hosting on managed servers might have some luck. For those that run their own servers, it's pretty easy to install from RPM or just compile it.

Sadly there isn't a way around needing some sort of geotargetting mechanism though. I thought about making it geotarget against my servers for people, but then people would complain about privacy and such with all the geotargetting requests going to a central server. Can't make everyone happy unfortunately. :)

Brandon Sheley 06-09-2010 04:08 AM

good deal, thanks Shawn

as7apcool 06-09-2010 05:34 AM

good work ... thanks alot

CoZmicShReddeR 06-09-2010 08:13 AM

I added extension=php_geoip.dll and restarted apache server and when I click on the map link I get

Fatal error: Call to undefined function geoip_record_by_name() \usermap.php on line 100

I am using vB_Datastore_Filecache

Abhik 06-09-2010 09:01 AM

Thank you for the release Shawn..

digitalpoint 06-09-2010 09:40 AM

Quote:

Originally Posted by CoZmicShReddeR (Post 2050871)
I added extension=php_geoip.dll and restarted apache server and when I click on the map link I get

Fatal error: Call to undefined function geoip_record_by_name() \usermap.php on line 100

Well for whatever reason it didn't get installed correctly if the functions aren't there... :)

Kolbi 06-09-2010 10:15 AM

Thanks!

TeknoSounds 06-09-2010 10:49 AM

dope :D Works wonderfully ty!

twitch 06-09-2010 01:38 PM

Quote:

Originally Posted by digitalpoint (Post 2050903)
Well for whatever reason it didn't get installed correctly if the functions aren't there... :)

same problem

noppid 06-09-2010 01:57 PM

It's not like the GeoIP site hands you the install instructions over there. But, I'm pretty sure a resourceful person could do the geoip pure install at the php file level rather then the apache server level if a shared host won't add it. http://geolite.maxmind.com/download/geoip/api/php/ Then you need the city database IIRC. http://www.maxmind.com/app/geolitecity and it looks like an edit to the DP php file to include the geoip api and initialize it.

Tubbietoeter 06-09-2010 03:24 PM

I asked my provider to install geoip and they did.

phpinfo says
geoip extension version 1.0.7
geoip library version 1004006
geoip.custom_directory no value no value

I get errors anyway:
Warnung: geoip_record_by_name() [function.geoip-record-by-name]: Required database not available at /var/lib/GeoIP/GeoIPCity.dat. in [path]/usermap.php (Zeile 100)
Warnung: Invalid argument supplied for foreach() in [path]/usermap.php (Zeile 128)
Warnung: Invalid argument supplied for foreach() in [path]/usermap.php (Zeile 133)
Warnung: Invalid argument supplied for foreach() in [path]/usermap.php (Zeile 152)
Warnung: geoip_record_by_name() [function.geoip-record-by-name]: Required database not available at /var/lib/GeoIP/GeoIPCity.dat. in [path]/usermap.php (Zeile 158)

am I doing something wrong?

noppid 06-09-2010 03:40 PM

Quote:

Originally Posted by Tubbietoeter (Post 2051055)
I asked my provider to install geoip and they did.

phpinfo says
geoip extension version 1.0.7
geoip library version 1004006
geoip.custom_directory no value no value

I get errors anyway:
Warnung: geoip_record_by_name() [function.geoip-record-by-name]: Required database not available at /var/lib/GeoIP/GeoIPCity.dat. in [path]/usermap.php (Zeile 100)
Warnung: Invalid argument supplied for foreach() in [path]/usermap.php (Zeile 128)
Warnung: Invalid argument supplied for foreach() in [path]/usermap.php (Zeile 133)
Warnung: Invalid argument supplied for foreach() in [path]/usermap.php (Zeile 152)
Warnung: geoip_record_by_name() [function.geoip-record-by-name]: Required database not available at /var/lib/GeoIP/GeoIPCity.dat. in [path]/usermap.php (Zeile 158)

am I doing something wrong?

They installed the default country database or provided the wrong path. You need GeoIP City.

voglermc 06-09-2010 04:46 PM

Would a different version be possible to build out based on profile field information and populate with certain info in profile fields of members?

I run a MINI Cooper Club site and it would be nice to see where our members are

digitalpoint 06-09-2010 04:48 PM

Quote:

Originally Posted by voglermc (Post 2051098)
Would a different version be possible to build out based on profile field information and populate with certain info in profile fields of members?

I run a MINI Cooper Club site and it would be nice to see where our members are

In theory you could modify it to run based on the location of the IP address they used to register, but I don't think Google Maps could handle that many pins on the map to be honest.

voglermc 06-09-2010 05:07 PM

We have around 1300 members right now. I'd just like members to see they have others close by. I'm not to up to date on google's api so I don't know what it can and can't do

Diablotic 06-09-2010 05:50 PM

voglermc: There is another modification that will let you create profiles and pin them on google maps. It can be found here: https://vborg.vbsupport.ru/showthread.php?t=123148 but there is no official release for 4.0 yet :(

digitalpoint 06-09-2010 06:56 PM

Quote:

Originally Posted by voglermc (Post 2051108)
We have around 1300 members right now. I'd just like members to see they have others close by. I'm not to up to date on google's api so I don't know what it can and can't do

If you want to make it work with registration IP addresses instead of currently online users, in the usermap.php file, change this:
PHP Code:

$forumusers $db->query_read_slave("
    SELECT
        session.userid, user.usergroupid, session.host, session.useragent, IF(user.usergroupid IN(" 
iif($vbulletin->options['digitalpoint_usermap_admins'], $db->escape_string($vbulletin->options['digitalpoint_usermap_admins']), 0) . "), 1, IF(user.userid > 0, 2, 3)) AS sortorder
    FROM " 
TABLE_PREFIX "session AS session
    LEFT JOIN " 
TABLE_PREFIX "user AS user ON(user.userid = session.userid)
    WHERE session.lastactivity > 
$datecut
    ORDER BY sortorder
    LIMIT 5000" 
"
"
); 

to this:
PHP Code:

$forumusers $db->query_read_slave("
    SELECT userid, usergroupid, ipaddress AS host, '' AS useragent, IF(usergroupid IN(" 
iif($vbulletin->options['digitalpoint_usermap_admins'], $db->escape_string($vbulletin->options['digitalpoint_usermap_admins']), 0) . "), 1, IF(userid > 0, 2, 3)) AS sortorder
    FROM " 
TABLE_PREFIX "user AS user
    ORDER BY sortorder
    LIMIT 5000" 
"
"
); 

I haven't tested it, but I think it should work (it's still going to limit it to 5000 users/pins... anything more than that probably would cause issues for Google Maps anyway).

Obviously it's not going to show pins for spiders/guests (only registered users and admins/mods).

Tubbietoeter 06-09-2010 07:16 PM

Quote:

Originally Posted by voglermc (Post 2051098)
Would a different version be possible to build out based on profile field information and populate with certain info in profile fields of members?

I run a MINI Cooper Club site and it would be nice to see where our members are

Aaaw dang, and I thought this was possible with this AddOn as well.
I run a Suzuki Jimny Club :D and we have the same need ... ;)

?$%& I really liked the looks of this ... *grmpf*

Hope there will be a good alternative for vb4 soon!

voglermc 06-09-2010 07:24 PM

Thank you both!

voglermc 06-09-2010 10:19 PM

error

Fatal error: Call to undefined function geoip_record_by_name() in /home/tarheel/public_html/usermap.php on line 97

docvader 06-09-2010 10:29 PM

vo, you dont have GEOIP on your server. Talk to your server host to install it.

voglermc 06-09-2010 10:37 PM

Thanks

voglermc 06-09-2010 11:10 PM

My host won't install on a shared server
Marked as uninstalled, wish I didn't have to

TeknoSounds 06-10-2010 07:08 AM

Yeah pretty much any shared hosting doesn't allow the geoip plugin as I've been told over and over its "too resource intensive". (was looking for stats generated by awstats)
But I moved over to my own dedicated server and runs wonderfully :)

funmasti 06-10-2010 10:13 AM

thanks shawn

Kolbi 06-10-2010 10:32 AM

Can you create a converter from the old vb membermap?

digitalpoint 06-10-2010 05:01 PM

Quote:

Originally Posted by TeknoSounds (Post 2051410)
Yeah pretty much any shared hosting doesn't allow the geoip plugin as I've been told over and over its "too resource intensive". (was looking for stats generated by awstats)
But I moved over to my own dedicated server and runs wonderfully :)

Sounds like a generic answer from your host because they didn't feel like installing it. It's INCREDIBLY *not* resource intensive...

http://www.maxmind.com/app/benchmark

Benchmarked at being able to do 22k+ lookups per second without any sort of caching.

Quote:

Originally Posted by Kolbi (Post 2051481)
Can you create a converter from the old vb membermap?

No idea what that is, sorry.

Tryppnotic69 06-10-2010 05:13 PM

Works great, Any way of getting registered users, admins, etc usernames to appear on the pins instead or along with View in Google Earth?

digitalpoint 06-10-2010 07:17 PM

Quote:

Originally Posted by Tryppnotic69 (Post 2051642)
Works great, Any way of getting registered users, admins, etc usernames to appear on the pins instead or along with View in Google Earth?

I had thought about doing it that way originally, but decided against it because if all the potential complaints from end-users about privacy issues.

Kolbi 06-10-2010 07:33 PM

An importer for this modifcation: https://vborg.vbsupport.ru/showthread.php?t=154533 would be very very nice.

Tryppnotic69 06-10-2010 07:59 PM

Quote:

Originally Posted by digitalpoint (Post 2051697)
I had thought about doing it that way originally, but decided against it because if all the potential complaints from end-users about privacy issues.

Would this be something fairly simple to add or would it require a lot of work? I don't know much about modding. I think it might be possible to add a check box to the registration page to accept being added to the member map. Might be cool to look into :-)

CoZmicShReddeR 06-10-2010 09:57 PM

Can anyone explain how to successfully install geoip on a xampp windows server??

I tried the mod_geoip as well but in any case I cannot get the php or the apache version running with windows...

digitalpoint 06-11-2010 12:58 AM

Quote:

Originally Posted by Kolbi (Post 2051713)
An importer for this modifcation: https://vborg.vbsupport.ru/showthread.php?t=154533 would be very very nice.

There's nothing really *to* import since mine is locating the user in realtime based on their IP address. That one appears to really just be a system where each user can put an arbitrary pin on the map (since the user can put it anywhere they want). If you want something like that, you probably would just want to ask the developer to update it since it's really something different.

Quote:

Originally Posted by Tryppnotic69 (Post 2051729)
Would this be something fairly simple to add or would it require a lot of work? I don't know much about modding. I think it might be possible to add a check box to the registration page to accept being added to the member map. Might be cool to look into :-)

Eh... it would be possible, but having people opt-into it would also have the affect of very few users actually using it. Personally, I like it the way it is now where it's a little more anonymous, but all users are on it.

giorgino 06-11-2010 05:40 AM

unistalled because no GeoIP on my server. Now I've an MySQL error...

Database error in vBulletin 4.0.3:

Invalid SQL:

SELECT languageid,
phrasegroup_global AS phrasegroup_global,
phrasegroup_usermap AS phrasegroup_usermap,
options AS lang_options,
languagecode AS lang_code,
charset AS lang_charset,
locale AS lang_locale,
imagesoverride AS lang_imagesoverride,
dateoverride AS lang_dateoverride,
timeoverride AS lang_timeoverride,
registereddateoverride AS lang_registereddateoverride,
calformat1override AS lang_calformat1override,
calformat2override AS lang_calformat2override,
logdateoverride AS lang_logdateoverride,
decimalsep AS lang_decimalsep,
thousandsep AS lang_thousandsep
FROM vb_language
WHERE languageid = 2;

MySQL Error : Unknown column 'phrasegroup_usermap' in 'field list'
Error Number : 1054
Request Date : Friday, June 11th 2010 @ 08:13:14 AM
Error Date : Friday, June 11th 2010 @ 08:13:14 AM
Script : http://www.mysite.it/usermap.php
Referrer :
Username :
Classname : vB_Database
MySQL Version :

How can I solve this?

digitalpoint 06-11-2010 05:09 PM

If you uninstalled it, you would also want to delete the usermap.php file. :)


All times are GMT. The time now is 06:30 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.01714 seconds
  • Memory Usage 1,839KB
  • 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
  • (2)bbcode_php_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete