Loading...
 
Features / Usability

Features / Usability


How to count (total) markers on GMap Usermap

posts: 3665 United States

I'm still fine-tuning my Google User Map (see here for prior discussion).

Is there a way to show the total number of markers on the map? I'd like to be able to show:

  • How many registered users the site has (via the UserCount plugin)
  • How many users have added themself to the map.


-R

posts: 214

If a user has added their self to the map, the coordinates are saved the the tiki_user_preferences table. If there are coordinates set, there should be both latitude and longitude values, so we could get a count of users with latitudes and that should be the number you are after.

Here is plugin USERGMAPCOUNT that will give you the count of users that have a latitude value set in tiki_user_preferences:

Copy to clipboard
~60~?php // Displays the number of users on usermap // Use: // {USERGMAPCOUNT()/} // require_once "lib/wiki/pluginslib.php"; function wikiplugin_usergmapcount_help() { return tra("Displays the number of users on usermap").":{USERGMAPCOUNT()/}"; } class CountGMapUsers extends ))PluginsLib(( { function run() { $query = "select count(*) FROM `tiki_user_preferences` where `prefName` = 'lat' and `value` != '0'"; $numusers = $this->getOne($query); return $numusers; } // run() } // class CountGMapUsers function wikiplugin_usergmapcount() { $plugin = new CountGMapUsers(); return $plugin->run(); } ?>