Loading...
 
Features / Usability

Features / Usability


How to have GMap Usermap show real name?

posts: 3665 United States

I am using the GMap User Map (tiki-gmap_usermap.php) to create a "mashup" of all users on my Tiki. It works great... except the map points use each users' login — I want to display the real name (when available).

In looking at the code, I see this query:

Copy to clipboard
$query = "SELECT `login`, `avatarType`, `avatarLibName`, p1.`value` as lon, p2.`value` as lat FROM `users_users` as u "; $query.= "left join `tiki_user_preferences` as p1 on p1.`user`=u.`login` and p1.`prefName`=? "; $query.= "left join `tiki_user_preferences` as p2 on p2.`user`=u.`login` and p2.`prefName`=? ";


Now, I wouldn't know a left join from an inner join smile but it looks like the query is trying to pull something from the tiki_user_preferences table. How can I make Tiki grab the realName field?

Ideally, I'd like to grab both the login and realName of each user.

Tx,

-R


posts: 214

Change the first $query = to:

Copy to clipboard
$query = "SELECT `login`, `avatarType`, `avatarLibName`, p1.`value` as lon, p2.`value` as lat, p3.`value` as realName FROM `users_users` as u ";

Add a new "left join" to the bottom of the select:

Copy to clipboard
$query.= "left join `tiki_user_preferences` as p3 on p3.`user`=u.`login` and p3.`prefName`=? ";

Add realName to the $tikilib array values:

Copy to clipboard
$result = $tikilib->query($query, array('lon','lat','realName'));

Then add the name to the displayed data (note, this does not check to see if a realName exists, you should probably add code to check for that and change the display to handle it if the user did not enter one):

Copy to clipboard
$out[] = array($res['lat'],$res['lon'],addslashes($image).'Name:'.$res['realName'].'Login:'.$res['login'].'Lat: '.$res['lon'].'° Long: '.$res['lat'].'°');

posts: 12

Ricks99

I know its a few months ago now but are you using 4.2 to run gmap mod.I'm seem to be having problems getting it to work on 4.2.

It could be me of course.

Leighton


Upcoming Events

1)  18 Apr 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  16 May 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  20 Jun 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
5)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7) 
Tiki birthday
8)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
9)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
10)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting