None of my mods, wherever you find them, are abandoned.
All of them are in developement, even if i am not active on phpbb.com.

[RC1] jQ User Map api3 v.0.9.0 (Update - 15.10.2016)

[DEV] 3.0.* Mod Base

[RC1] jQ User Map api3 v.0.9.0 (Update - 15.10.2016)

Postby Sekuro » 06 Dec 2011, 00:36

jQ User Map api3

MOD-Title: jQ User Map api3
MOD-Version: 0.9.0
MOD-Author: 4seven / BNa

Request topic: http://www.phpbb.com/community/viewtopi ... #p13078463

Credits: Googlecode for googlemap/geocode from their fantastic api 3

phpBB-Version: phpBB 3.0.x
phpBB-Languages: en
phpBB-Styles: prosilver

MOD-Description: This Mod adds a User Map to your forum

Features:
- jQ User Map, based on Google Map api v3 with Streetview
- Clear Mod Design without bells and whistles
- Uses native phpbb3 CPFs to setup (Location/Location Description)
- Full address mode with several possibilitys:
- zip(if unique or/and specific), land, state, town, street (each mixed or alone)
- Map user list > 'Jump to User' (zooming+centering location)
- V3 cluster engine mentioned here by javiexin with adjustable grid sensitivity
- Clustering user, who lives near, instead of x markers
- Rightclick on marker opens link to user profile
- Optional weather / clouds overlay
- Changeable geocode provider
- User online/offline status
- Slim js engine /~ 6 sql requests
- Location failure prevent
- Works with jQ User Weather
- xhtml 1.0 strict valid
- Easy install

Planned:
- ?

Changes in v.0.0.2
  • adding "smooth moving" by changing location on userlist ('Jump to User') by click,
    if clicked location resides in current map view.
  • switchable overlay section: weather, clouds.
  • adding 'marker-feedback' by mouseover on userlist ('Jump to User') (scroll over list)
    requested by PatrickS3.

Changes in v.0.0.3
  • fixing sql error caused by unneeded geocode requests
  • new error-prevent and request-sparing to prevent blacklisting
  • alternativ geocode provider as failover

Changes in v.0.9.0
  • fixing compatibility error with new google api version
  • including Marker Adjust Addition
  • optimizing some code

Viewtopic Addon: viewtopic.php?f=3&t=109#p324

Marker Adjust Addition: viewtopic.php?f=3&t=109#p347

Center init map: (default: admin location)
viewtopic.php?f=3&t=109&p=364#p364

Load custom profile fields / Addition I v.0.0.3
viewtopic.php?f=3&t=109#p459

MOD-Demo:
http://4seven.bplaced.net/forum/1/index.php

Link in overall header Image User Map

test account: http://4seven.bplaced.net/forum/1/membe ... ofile&u=53
un: tester / pw: tester (ucp > profile, setup 'User Map Location' and watch 'User Map' after that)

Also feel free to register and fill the dev map with life.

Download: v.0.0.1
jQ_User_Map_api3_v.0.0.1.zip
(54.27 KiB) Downloaded 528 times

Download: v.0.0.2
jQ_User_Map_api3_v.0.0.2.zip
(56.81 KiB) Downloaded 463 times

Download: v.0.0.3
jQ_User_Map_api3_v.0.0.3.zip
(57.67 KiB) Downloaded 726 times

Download: v.0.9.0
jQ_User_Map_api3_v.0.9.0.zip
(62.68 KiB) Downloaded 839 times

Image

Image

Note: You must add the named custom profile fields before mod install

Basic Instruction: viewtopic.php?p=282#p282

v.1.0.0 preview

  • adding location check on registration (if set this way in acp) **
  • some finetuning and optimization

** Demo: http://4seven.bplaced.net/forum/1/ucp.php?mode=register - Feel free to check it out. Failure message comes, if something is wrong. If all is proper a map preview appears. All this stuff work without site reload.
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



jQ User Map api3 / Basic Instruction

Postby Sekuro » 03 Mar 2012, 02:51

Basic Instruction for jQ User Map api3

Note: You must do this before mod install

1. Make the first Custom Profile Field (CPF) with following exact entrys and settings (exclusive language relevant entrys)

1_map.png

2_map_weather.png


    ACP

    USERS AND GROUPS

    Custom profile fields

    ADD a new CPF

    Therefore enter user_map_weather in the textfield, add [Single text field] and click [Create new field]

    The main settings should look like that:

    Edit profile field

    Field type: Single text field

    Field identification: user_map_weather

    Publicly display profile field: Yes

    Visibility options

    Display in user control panel: Yes

    Display on registration screen: Your choice

    Display on viewtopic screen: Your choice

    Required field: Your choice

    Hide profile field: Your choice

    ---------------------------

    Language specific options [en]

    Field name/title presented to the user: User Weather / User Map Location

    Field description: Enter Your location without foreign signs. So write Sao Paulo instead of São Paulo. If a town exists two times or more, enter also the state, eg. 'Berlin Vermont', after a blank. You can also use complete address with zip code eg. '67 Cherry Street Burlington VT 05401' or a part of (if unique in the world). Each part of full address seperate with a blank.

    Default value: Empty

    --------------------

    Click [Profile type specific options]

    -------------------

    Profile type specific options

    Length of input box: 50

    Minimum number of characters: 0

    Maximum number of characters: 50

    Field validation: Alphanumeric and spacers

    --------------------------

    Click [Save]

    Deactivate the CPF field

    -------------------


2. Make the second Custom Profile field with following exact entrys and settings (exclusive language relevant entrys)

3_2_map_desc.png

3_1_map_desc.png


    ACP

    USERS AND GROUPS

    Custom profile fields

    ADD a new CPF

    Therefore enter user_map_desc in the textfield, add [Textarea] and click [Create new field]

    The main settings should look like that:

    Edit profile field

    Field type: Textarea

    Field identification: user_map_desc

    Publicly display profile field: Yes

    Visibility options

    Display in user control panel: Yes

    Display on registration screen: Your choice

    Display on viewtopic screen: Your choice

    Required field: Your choice

    Hide profile field: Your choice

    ---------------------------

    Language specific options [en]

    Field name/title presented to the user: User Weather / User Map Location Description

    Field description: Give a short description of your location.

    Default value: Empty

    --------------------

    Click [Profile type specific options]

    --------------------

    Profile type specific options

    Length of input box:
    5 Rows
    80 Columns

    Minimum number of characters: 0

    Maximum number of characters: 400

    Field validation: Any character

    --------------------

    Click [Save]

    Deactivate the CPF field

    -------------------


3. Check also these settings in ACP to make all work properly

    ACP

    GENERAL

    SERVER CONFIGURATION

    Load Settings

    Custom profile fields

    Allow styles to display custom profile fields in memberlist: Your choice

    Display custom profile fields in user profiles: Yes

    Display custom profile fields on topic pages: Your choice


4. Install the mod

5. Activate both CPF fields

6. Deactivate both CPF fields again

7. Activate both CPF fields again
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



jQ User Map api3 v.0.0.2 - Viewtopic Addition

Postby Sekuro » 18 Apr 2012, 17:38

Viewtopic Addition

requested here by PatrickS3 and here by 2xS

demo: http://4seven.bplaced.net/forum/1/viewt ... p=496#p496

Instruction

- download this two images and store it in root/user_weather/

Image Image rightclick > save image under..

- open

viewtopic.php

find

Code: Select all
// Output the posts
$first_unread = $post_unread = false;


before add

Code: Select all
        // jQ User Map api3 / Viewtopic Addition / 4seven / 2012
        $sql = 'SELECT user_id
                FROM '
  . USERS_TABLE . '
                WHERE user_map_latitude != 0'
;
        // $result = $db->sql_query($sql, 3600);
        $result = $db->sql_query($sql);
        
        while 
($row = $db->sql_fetchrow($result))
        {
        $user_id_array[] = $row['user_id'];
        }
        
        $db
->sql_freeresult($result);
        // jQ User Map api3 / Viewtopic Addition / 4seven / 2012        


find

Code: Select all
        'S_HAS_ATTACHMENTS'    => (!empty($attachments[$row['post_id']])) ? true : false,


after add

Code: Select all
        // jQ User Map api3 / Viewtopic Addition / 4seven / 2012
        'U_POSTER_MAP'        =>  append_sid("{$phpbb_root_path}user_weather/user_map.$phpEx", 'poster_map=' . $poster_id),    
        
'S_HAS_LOCATION'   => (in_array($poster_id, $user_id_array)) ? true : false,
        // jQ User Map api3 / Viewtopic Addition / 4seven / 2012        


open

user_weather/user_map.php

find

Code: Select all
//load config file, for later structuring    
if (!isset($map_initial_zoom))
{
include(
$phpbb_root_path . 'user_weather/user_map_config.' . $phpEx);
}

        $template->assign_vars(array(


after add

Code: Select all
        'UM_POSTER_MAP'      =>  request_var('poster_map', 0),


open

styles/prosilver/template/user_map.html

find

Code: Select all
markers.push(marker);


after add

Code: Select all
if ({UM_POSTER_MAP} == locations[i][2]){
map.setCenter(new google.maps.LatLng(locations[i][0], locations[i][1]));
zoomLevel = 6;
map.setZoom(zoomLevel);
marker.styleIcon.set("color","#FFFFFF");}


open

styles/prosilver/template/viewtopic_body.html

find

Code: Select all
<!-- IF postrow.U_PM or postrow.U_EMAIL or postrow.U_WWW or postrow.U_MSN or postrow.U_ICQ or postrow.U_YIM or postrow.U_AIM or postrow.U_JABBER --> 

replace with

Code: Select all
<!-- IF postrow.U_PM or postrow.U_EMAIL or postrow.U_WWW or postrow.U_MSN or postrow.U_ICQ or postrow.U_YIM or postrow.U_AIM or postrow.U_JABBER or postrow.S_HAS_LOCATION --> 

find

Code: Select all
                    <!-- IF postrow.U_JABBER --><li class="jabber-icon"><a href="{postrow.U_JABBER}" onclick="popup(this.href, 550, 320); return false;" title="{L_JABBER}"><span>{L_JABBER}</span></a></li><!-- ENDIF --> 

after add

Code: Select all
                    <!-- IF postrow.S_HAS_LOCATION --><li><a href="{postrow.U_POSTER_MAP}"><img src="user_weather/user_map_1.png" onmouseover="this.src='user_weather/user_map_2.png';" onmouseout="this.src='user_weather/user_map_1.png';" alt ="" /></a></li><!-- ENDIF --> 

clear all available caches
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



[DEV] jQ User Map api3 v.0.0.2 - German Translation

Postby Sekuro » 19 Apr 2012, 22:24

German Translation
by PatrickS3

Instruction

open

language/de/common.php

find

Code: Select all
$lang = array_merge($lang, array


after add

Code: Select all
   // jQ User Map api3  / 4seven / 2012
   'U_M'           => 'Mitgliederkarte',
   'U_M_NO'        => 'Keine Mitglieder in der Karte',
   'U_M_JUMP'      => 'Springe zum Mitglied',
   'U_M_FULL'      => 'Zeige komplette Karte',
   'U_M_LOC'       => 'Standort',
   'U_M_LOC_DESC'  => 'Standort Beschreibung',
   'U_M_VIEW_MAP'  => 'Betrachtet Mitgliederkarte',
   'U_M_SET_OVER'  => 'Overlay Anzeige',
   'U_M_SET_WEAT'  => 'Wetter',
   'U_M_SET_CLOU'  => 'Wolken',
   'U_M_SET_BTTN'  => 'Anzeigen | Entfernen',
       
   'U_W_PANEL_LOC' => 'Standort',   
   'U_W_PANEL_SUC' => 'wurde erfolgreich eingerichtet.',   
   'U_W_PANEL_EMP' => 'ist leer.',   
   'U_W_PANEL_BAD' => 'falscher Wert für Standort:',   
   'U_W_PANEL_AGA' => 'Versuche es mit einem anderen Standort.',
   // jQ User Map api3  / 4seven / 2012
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



[DEV] jQ User Map api3 v.0.0.2 - Release

Postby Sekuro » 19 Apr 2012, 22:36

v.0.0.2 released

Changes
  • adding "smooth moving" by changing location on userlist ('Jump to User') by click,
    if clicked location resides in current map view.
  • switchable overlay section: weather, clouds.
  • adding 'marker-feedback' by mouseover on userlist ('Jump to User') (scroll over list)
    requested by PatrickS3.
[de] translation by PatrickS3
viewtopic.php?f=3&t=109&p=332#p331

Update Instruction
Upload new version of
    user_weather/user_map.php
    user_weather/user_map_config.php*
    styles/prosilver/template/user_map.html
*save old config, config/check new config and re-upload

- Check edits in
    language/de/common.php

- Clear all caches
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



Re: jQ User Map api3 v.0.0.2 - Marker Adjust Addition

Postby Sekuro » 03 May 2012, 19:10

Marker Adjust Addition

If much people have the exact same location, may a town with no other values,
this addition fixes the exact same positioning of markers in google maps api3.

Suggested here by purusam

Demo: http://4seven.bplaced.net/forum/1/user_weather/user_map.php

same_location_1.png
same_location_1.png (33.55 KiB) Viewed 28468 times

same_location_2.png
same_location_2.png (245.52 KiB) Viewed 28468 times

The attachments shows 3 users with the exact same location. The positioning among themselves is randomly generated.
If many users have the exact same location, it can have some overlappings, but the same marker position is near unlikely.

Instruction

open

styles/prosilver/template/user_map.html

find

Code: Select all
// div block
function divover(iloc){


before add

Code: Select all
// user one same location - random engine
// thanks to naden @ naden.de
function getRandom(min, max) {
 if(min > max) {
  return -1;
 }
 
 if
(min == max) {
  return min;
 }
 
 var r
;
 
 do 
{
  r = Math.random();
 }
 while(== 1.0);
 
 return min 
+ parseInt(* (max-min+1));
}


find

Code: Select all
var markers = []; 


after add

Code: Select all
// user one same location - build coords array
var coords = []; 


find

Code: Select all
// BEGIN ROW
for (= 0; i < locations.length; i++) {


after add

Code: Select all
// user one same location - main engine
// thanks to Sam UL @ techxplorer.com

// get the coordinates hash
var hash = locations[i][0] + locations[i][1];
hash = hash.replace(".","").replace(",", "").replace("-","");

// check if we see this hash before
if(coords[hash] == null){

  // get coordinate object
  var positions = new google.maps.LatLng(parseFloat(locations[i][0]), parseFloat(locations[i][1]));

  // store an indicator that we've seen this point before
  coords[hash] = 1;
  
  
} else {

  // add some randomness to this point
  var lats = parseFloat(locations[i][0]) + (getRandom(1, 4) / 1500);
  var lngs = parseFloat(locations[i][1]) + (getRandom(1, 4) / 1500);

  // get coordinate object
  var positions = new google.maps.LatLng(lats.toFixed(6), lngs.toFixed(6));
}


find

Code: Select all
position  : new google.maps.LatLng(locations[i][0], locations[i][1]),


replace with

Code: Select all
// user one same location - set new marker position
position  : positions, 
// position  : new google.maps.LatLng(locations[i][0], locations[i][1]), << old code      
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



Center init map to custom location

Postby Sekuro » 09 Jun 2012, 01:10

Center init map to custom location
(default: admin location)

open

styles/prosilver/template/user_map.html.

find

Code: Select all
// The init map   


before add

Code: Select all
// First position goes to admin
var init_loc_0 43.53262;
var 
init_loc_1 12.019043


find

Code: Select all
center: new google.maps.LatLng(locations[0][0], locations[0][1]), 


replace with

Code: Select all
center: new google.maps.LatLng(init_loc_0init_loc_1), 


find

Code: Select all
// First position goes to admin
var init_loc_0 locations[0][0];
var 
init_loc_1 locations[0][1];  


replace with

Code: Select all
// First position goes to admin
// var init_loc_0 = locations[0][0];
// var init_loc_1 = locations[0][1];    


now it should work with the user map link,
which is located after the last find and have this variable already.

Code: Select all
map.setCenter(new google.maps.LatLng(init_loc_0init_loc_1));  


may also open

user_weather/user_map_config.php

find

Code: Select all
// Map Initial Zoom / Default: 4
$map_initial_zoom     4

and play with the $map_initial_zoom value for finetuning of the viewable segment on start ;)
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



Re: [DEV] jQ User Map api3 v.0.0.3

Postby Sekuro » 09 Jun 2012, 02:26

v.0.0.3 released

see anouncement and first post for further details

Fixing/Changes

  • fixing sql error caused by unneeded geocode requests
  • new error-prevent and request-sparing to prevent blacklisting
  • alternativ geocode provider as failover
Update Instruction

  • Download v.0.0.3 package
open

includes/functions_user_map.php

Set geocode provider > default: google

Code: Select all
// GOOGLE API
// Google Basic Api
$google_api = true;

// OPEN API
// Mapquestapi Nominatim Api
$nomina_api = false;

// OPEN API
// Mapquestapi Geocoding Api
$geocod_api = false;


  • Upload new version of

    includes/functions_user_map.php
  • Check edits in

    language/en/common.php
    includes/acp/acp_users.php
    includes/ucp/ucp_profile
  • Clear all caches
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



Re: [DEV] jQ User Map api3 v.0.0.3

Postby Sekuro » 18 Jun 2012, 22:02

~
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



[DEV] jQ User Map api3 v.0.0.3 / Addition I v.0.0.3

Postby 4seven » 11 Jul 2012, 17:09

Load custom profile fields / Addition I v.0.0.3

Customize all available CPFs with template switches

Note: This Addition is tested and added to demo

Credit: Thanks to javiexin for inspirations.

Instruction

open

user_weather/user_map.php

find

Code: Select all
    if (!function_exists('get_user_avatar'))
    {
    include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
    


after add

Code: Select all
            // Load custom profile fields / Addition v.0.0.3
            include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);    
            
            
// Grab all profile fields from users in id cache for later use
            $cp = new custom_profile();    
            $profile_fields_cache 
= $cp->generate_profile_fields_template('grab', $user_id_array);
            // Save from following SQL:  , user_map_location, user_map_location_desc
            // Load custom profile fields / Addition v.0.0.3       


find and delete

Code: Select all
, user_map_location, user_map_location_desc


find

Code: Select all
        $row_username  = utf8_encode(urlencode($row['username'])); 


after add

Code: Select all
        // Load custom profile fields / Addition v.0.0.3
        $cp_row    = $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$row['user_id']]);
        
        $memberrow 
= array(

            'UM_LATITUDE'      => $row['user_map_latitude'],
            'UM_LONGITUDE'     => $row['user_map_longitude'],
            'UM_USER_ID'       => $row['user_id'],
            'UM_ON_COLOUR'     => $online_colour,
            'UM_USERNAMES'     => $row_usernames,
            'UM_USERNAME'      => $row_username,
            'UM_USER_PROFILE'  => str_replace('&amp;', '&', append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id'])),
            'UM_USERAVATAR'    => (!empty($row['user_avatar'])) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '<img src="'.$phpbb_root_path.'images/no_avatar.png" alt="" />'

            );

            if (isset($cp_row['row']) && sizeof($cp_row['row']))
            {
            $memberrow = array_merge($memberrow, $cp_row['row']);
            }

            $template->assign_block_vars('user_map', $memberrow);            
            
// Load custom profile fields / Addition v.0.0.3             


Find and delete

Code: Select all
        $template->assign_block_vars('user_map', array(

            'UM_LATITUDE'      => $row['user_map_latitude'],
            'UM_LONGITUDE'     => $row['user_map_longitude'],
            'UM_USER_ID'       => $row['user_id'],
            'UM_ON_COLOUR'     => $online_colour,
            'UM_USERNAMES'     => $row_usernames,
            'UM_USERNAME'      => $row_username,
            'UM_USER_PROFILE'  => str_replace('&amp;', '&', append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id'])),
            'UM_USERAVATAR'    => (!empty($row['user_avatar'])) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '<img src="'.$phpbb_root_path.'images/no_avatar.png" alt="" />',
            'UM_LOCATION'      => ucwords(str_replace('_', ' ', $row['user_map_location'])),
            'UM_LOCATION_DESC' => ($row['user_map_location_desc'] !== 0) ? $row['user_map_location_desc'] : false    

            
)); 


open

styles/prosilver/template/user_map.html

find

Code: Select all
<br /><br />
{
L_U_M_LOC}:<br />
{
user_map.UM_LOCATION}
<!--
 IF user_map.UM_LOCATION_DESC -->
<
br /><br />
{
L_U_M_LOC_DESC}:<br />
{
user_map.UM_LOCATION_DESC}
<!--
 ENDIF --> 


replace with

Code: Select all
<!-- Load custom profile fields / Addition -->

<!--
 IF user_map.S_PROFILE_USER_MAP_WEATHER -->
<
br /><br />
{
user_map.PROFILE_USER_MAP_WEATHER_NAME}:
<
br />
{
user_map.PROFILE_USER_MAP_WEATHER_VALUE}
<!--
 ENDIF -->

<!--
 IF user_map.S_PROFILE_USER_MAP_DESC -->
<
br /><br />
{
user_map.PROFILE_USER_MAP_DESC_NAME}: 
<br />
{
user_map.PROFILE_USER_MAP_DESC_VALUE}
<!--
 ENDIF -->

<!--
 Load custom profile fields / Addition --> 


Explanation:

For further cpf fields:

Check availability with

<!-- IF user_map.S_PROFILE_YOUR_CPF_IDENT -->

For name and value take

{user_map.PROFILE_YOUR_CPF_IDENT_NAME}
{user_map.PROFILE_YOUR_CPF_IDENT_VALUE}
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
4seven

Tiptop

Tiptop
 
Posts: 318
Joined: 20 Jun 2012, 16:55
 
Resolution: 1920x1080


Next

Return to phpbb 3.0.* St@ff

Who is online

Users browsing this forum: No registered users and 1 guest

cron