The idea came from this post http://drupal.org/node/367305, titled 'Map location of visitors to a website'. There seems to be a good bit of interest in this module.
Lots of times after I post on a particular topic, I spend time several days afterwards looking through my site logs and copying and pasting IP address onto various mapping sites that convert IPs to geographic locations. I like to know where my visitors are coming from.
There are several other mapping related modules but none that I have found to fill this particular need. Most others will map nodes or registered users but none map just anonymous visitors. Also, this module does not rely on any other module, you just drop it in and it starts working.
I have made every attempt to fully document the module and have stuck as closely as possible to the coding-standards.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | visitorinfo.zip | 6 KB | twooten |
| #9 | visitorinfo.zip | 6 KB | twooten |
| #7 | visitorinfo.zip | 6 KB | twooten |
| #1 | visitorinfo.zip | 5.55 KB | twooten |
Comments
Comment #1
twooten commentedComment #2
twooten commentedI now have a demonstration page running on my site here that shows the last 300 or so visitors.
Comment #3
mtsanford commentedIf you're going to have global you need to respect name space rules. Better not to have them at all.
same with javascript variables. You should use 'setting' rather than 'inline' in the drupal_add_js function. See http://api.drupal.org/api/function/drupal_add_js/6
You should provided a theme function ot template, so that users of your module can override the default html output of the map. Also, I don't see any use of t() to allow user interface text to be translated.
You're nesting
<p>tags. It's a good idea to break up text passed through t() into smaller bites too, and keep markup for blocks (p, div, etc) out of text to be translated.Rather than doing this inline, it's preferable to put this in an external js file. As a bare minimum you *must* ensure you are not going to have name collisions with other modules. Drupal.behaviors.yourmodulesnamespace= function (context) {} can be used for functions to be run on windows loading after the DOM is setup. Drupal.yourmodule = {} can be used for just about anything you want, and you get your own javascript namespace that way. Look at the way some other modules are using javascript.
Schema descriptors don't go through t().
hook_init is not called for cached pages, therefore anonymous users will not be logged if the admin has caching enabled, which would defeat the point of this module. You might try hook_boot.
You also need to include the a LICENSE.txt with the GPL2 license.
(I'm not an 'official' reviewer, just helping out while I'm waiting on my own CVS request)
Comment #4
mtsanford commentedComment #5
avpadernoThe license file is added from the packaging script, and it is not allowed to commit that file in CVS.
Comment #6
avpadernoThe first argument of
t()is a literal string, not a dynamic value; differently, the script to extract the strings to translate will not extract the string.Comment #7
twooten commentedThanks for the pointers. I believe I've got all those taken care of.
Tim
Comment #8
avpadernoUse a placeholder.
Comment #9
twooten commentedLike so?
Comment #10
twooten commentedComment #11
avpadernoStrings used in user interface should have the first word in capital case, and the other words in lower case (with the exception of proper nouns, adjectives derived from proper nouns, and acronyms).
Comment #12
twooten commentedI changed the case of those words. Thanks kiamlaluno.
Comment #13
avpadernodb_rewrite_sql()uses the following default arguments$primary_table = 'n', $primary_field = 'nid', $args = array(), which are the same arguments used for the call to the function made from the code I reported. Considering that node.module uses the following implementation ofhook_db_rewrite_sql()it is probable that the query would be altered in a not appropriate mode.
Also that line should be using .
hook_boot()is called when Drupal is still bootstrapping. The function you are calling is probably not yet available; see drupal_bootstrap() for more details.hook_boot()is then not supposed to return any values.See comment #11.
Comment #14
mtsanford commentedYou need to play nice with other javascript libraries, specifically jQuery which is core to Drupal. Overwriting window.onload is a good way to break things.
You should use:
or
As well as playing nice with jQuery, this puts symbols in their own scope. The way you have it, your variables and function names are in the global scope, so if any other js file defines those symbols, things break. The above two constructions solve that problem.
I'm not sure, but I think you can use this jQuery snippet for the unload:
$(window).unload( function () { GUnload(); } );
Comment #15
avpadernoThe CVS account has been already approved. The CVS application is not anymore necessary.
Comment #17
avpaderno