Skip to Content Skip to Menu

Google Maps - show username instead of name

  • Bandola
  • Bandola
  • OFFLINE
  • Posts: 11
  • Thanks: 0
  • Karma: 0
18 years 3 months ago #16653 by Bandola
How can I replace the name (real name) that is shown when I hover the mouse over the markers on the map, with the user name.
I have tried use the field Username, but i doesn't seem to work.

I also wonder if anyone knows how to link the popup-window to the CB-profile? "View profile"

Would be very happy for some help!

Please Log in or Create an account to join the conversation.

  • Bandola
  • Bandola
  • OFFLINE
  • Posts: 11
  • Thanks: 0
  • Karma: 0
18 years 3 months ago #16887 by Bandola
I have found out that I must change the SQL-statement in google_maps.class.php.

I got this information from the author of the component, who is on vacation now:
Try changing it to b.id, b.user_id, a.* or b.*, a.* (I'm going to use a real period now). You need the b.id in there because it uses that variable later on in the SQL statement. Or you might want to look in the jos_comprofiler table and look for the user id there. That way you can keep the same SQL statement, but just refer to the user name in the comprofiler table (if it's in there)

case '1': // all user data is gathered whether they are online or not.
$query4 = 'SELECT b.name, a.* FROM #__users AS b'
. ' INNER JOIN #__comprofiler AS a ON a.id = b.id'
. ' WHERE a.cb_geolatitude != "" LIMIT 125';
$database->setQuery( $query4 );
$tmp = $database->loadObjectList();
break;

case '2': // only online user data is gathered

$query4 = 'SELECT DISTINCT b.name, a.* FROM #__users AS b, #__comprofiler AS a, #__session AS c'
. ' WHERE a.id = b.id AND c.userid = a.id'
. ' AND a.cb_geolatitude != "" LIMIT 125';
$database->setQuery( $query4 );
$tmp = $database->loadObjectList();
break;

I have tried but can't get this working. Anyone knows how to re-write the code?

Please Log in or Create an account to join the conversation.

  • martijn189
  • martijn189
  • OFFLINE
  • Posts: 19
  • Thanks: 0
  • Karma: 26
18 years 3 months ago #17076 by martijn189
Replied by martijn189 on topic Re:Google Maps - show username instead of name
ye sure here is how i did it......

1
Goto /administrator/components/com_google_maps/google_maps.class.php

2
FIND
$query4 = 'SELECT b.name, a.* FROM #__users AS b'

REPLACE WITH
$query4 = 'SELECT b.*, a.* FROM #__users AS b'

FIND
$query4 = 'SELECT DISTINCT b.name, a.* FROM #__users AS b, #__comprofiler AS a, #__session AS c'

REPLACE WITH
$query4 = 'SELECT DISTINCT b.*, a.* FROM #__users AS b, #__comprofiler AS a, #__session AS c'

FIND
$info .= ($row->name) ? '<name>'.str_replace($badChars,$goodChars,$row->name).'</name>' : '<name />';

REPLACE WITH
$info .= ($row->username) ? '<name>'.str_replace($badChars,$goodChars,$row->username).'</name>' : '<name />';

and that's it........

CB3PD Developer assistent - phpBB Connector plugin

Please Log in or Create an account to join the conversation.

  • Bandola
  • Bandola
  • OFFLINE
  • Posts: 11
  • Thanks: 0
  • Karma: 0
18 years 3 months ago #17348 by Bandola
Thank you!!

This works fine.

/Ola

Please Log in or Create an account to join the conversation.

  • Bandola
  • Bandola
  • OFFLINE
  • Posts: 11
  • Thanks: 0
  • Karma: 0
18 years 2 months ago #17458 by Bandola
Since youy seems to know this component very well...

Is there a way to link the user name in the popup window to the CB-profile? That would be awesome!

Please Log in or Create an account to join the conversation.

  • Bandola
  • Bandola
  • OFFLINE
  • Posts: 11
  • Thanks: 0
  • Karma: 0
18 years 2 months ago #17459 by Bandola
By the way.

They have rewritten the component which mean I can't make the change you described. Can't find that query.

Can I do this another way. This feature is included in the new version 2.5b but I just can't make it work. Have mailed th author several times. I have tried to reinstall, refresch, clear cache, Firefox/IE, everything.

So I guess a hack is the only solution for me...

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum