Location Mod

Started by Gobalopper, November 19, 2004, 01:43:12 AM

Previous topic - Next topic

Adamzon

Is there a way to make this mod to work like a "pin point - resturant locator?"
My idea is to use this mod to work like a locator for resturants
Members add his/hers favorite resturant in a forum topic, and it pins out the location on the map
for others to easy find :)


Gobalopper

Hey guys, new version for 1.1.1. Let me know of any problems.

provid

Thanks a lot. It works :D

siath70

Seems to me the who flag addon is missing a chunk of code:

It does this:
<file name="$sourcedir/Who.php">
      <operation>
         <search position="replace"><![CDATA[
         mem.realName, IFNULL(mem.showOnline, 1) AS showOnline, lo.session, mg.onlineColor
      FROM {$db_prefix}log_online AS lo
         LEFT JOIN {$db_prefix}members AS mem ON (lo.ID_MEMBER = mem.ID [nofollow]_MEMBER)]]></search>
         <add><![CDATA[
         mem.realName, IFNULL(mem.showOnline, 1) AS showOnline, lo.session, mg.onlineColor, ip2c.c2code, lc.name [nofollow], pin.country [nofollow]
      FROM {$db_prefix}log_online AS lo
         LEFT JOIN {$db_prefix}members AS mem ON (lo.ID_MEMBER = mem.ID [nofollow]_MEMBER)
         LEFT JOIN {$db_prefix}location_ip2country AS ip2c ON (ip2c.ip_from <= lo.ip AND ip2c.ip_to >= lo.ip)
         LEFT JOIN {$db_prefix}location_country AS lc ON (lc.c2code = ip2c.c2code)
         LEFT JOIN {$db_prefix}mm_pins AS pin ON (pin.ID_MEMBER = lo.ID [nofollow]_MEMBER)]]></add>
      </operation>

      <operation>
         <search position="before"><![CDATA[
         'is_hidden' => $row['showOnline'] == 0,]]></search>
         <add><![CDATA[
         'flag' => array($row['c2code'], $row['name']),
         'url' => $row['url'],]]></add>
      </operation>
   </file>


I was getting an error and when I went back to my back up i found once I put in the old who it worked fine. I tracked through the code and found that it needed all this.
      SELECT COUNT(*)
      FROM {$db_prefix}log_online AS lo
         LEFT JOIN {$db_prefix}members AS mem ON (lo.ID_MEMBER = mem.ID [nofollow]_MEMBER)
         LEFT JOIN {$db_prefix}location_ip2country AS ip2c ON (ip2c.ip_from <= lo.ip AND ip2c.ip_to >= lo.ip)
         LEFT JOIN {$db_prefix}location_country AS lc ON (lc.c2code = ip2c.c2code)
         LEFT JOIN {$db_prefix}mm_pins AS pin ON (pin.ID_MEMBER = lo.ID [nofollow]_MEMBER)" . (!allowedTo('moderate_forum') ? "
      WHERE IFNULL(mem.showOnline, 1) = 1" : ''), __FILE__, __LINE__);
   list ($totalMembers) = mysql_fetch_row($request);
   mysql_free_result($request);

----Snip----

   // Look for people online, provided they don't mind if you see they are.
   $request = db_query("
      SELECT
         (UNIX_TIMESTAMP(lo.logTime) - UNIX_TIMESTAMP() + " . time() . ") AS logTime,
         lo.ID [nofollow]_MEMBER, lo.url, INET_NTOA(lo.ip) AS ip, mem.realName, lo.session,
         mg.onlineColor, IFNULL(mem.showOnline, 1) AS showOnline, ip2c.c2code, lc.name [nofollow], pin.country [nofollow]
      FROM {$db_prefix}log_online AS lo
         LEFT JOIN {$db_prefix}members AS mem ON (lo.ID_MEMBER = mem.ID [nofollow]_MEMBER)
         LEFT JOIN {$db_prefix}location_ip2country AS ip2c ON (ip2c.ip_from <= lo.ip AND ip2c.ip_to >= lo.ip)
         LEFT JOIN {$db_prefix}location_country AS lc ON (lc.c2code = ip2c.c2code)
         LEFT JOIN {$db_prefix}mm_pins AS pin ON (pin.ID_MEMBER = lo.ID [nofollow]_MEMBER)
         LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID [nofollow]_POST_GROUP, mem.ID [nofollow]_GROUP))" . (!allowedTo('moderate_forum') ? "
      WHERE IFNULL(mem.showOnline, 1) = 1" : '') . "
      ORDER BY $_REQUEST[sort] " . (isset($_REQUEST['asc']) ? 'ASC' : 'DESC') . "
      LIMIT $context[start], $modSettings[defaultMaxMembers]", __FILE__, __LINE__);
   $context['members'] = array();
   $member_ids = array();
   $url_data = array();
   while ($row = mysql_fetch_assoc($request))
   {
      $actions = @unserialize($row['url']);
      if ($actions === false)
         continue;

      // Send the information to the template.
      $context['members'][$row['session']] = array(
         'id' => $row['ID_MEMBER'],
         'ip' => allowedTo('moderate_forum') ? $row['ip'] : '',
         // It is *going* to be today or yesterday, so why keep that information in there?
         'time' => strtr(timeformat($row['logTime']), array($txt['smf10'] => '', $txt['smf10b'] => '')),
         'timestamp' => forum_time(true, $row['logTime']),
         'query' => $actions,
         'is_hidden' => $row['showOnline'] == 0,
         'flag' => array($row['c2code'], $row['name']),
         'url' => $row['url'],

Of course correct me if I'm wrong but it is working on my site now.

Siath

mrselnombre

using the above i inserted the missing code into my who.php and it works now..
thank you.
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
Total Twaddle.

Gobalopper

Ok, I posted a new version of who flags that should have a fix for that.

Threepwud

Hi there! My members like this so thanks very much. It's a nice piece of work :)

On the http://www.hldrforum.com/index.php?action=who area though, it gives me
Not unique table/alias: 'ip2c'
File: /home/hldrforu/public_html/Sources/Who.php
Line: 107

I've seen the error (roughly page 45 of this thread) but didn't see a fix. Is there any help for this one?

Thanks so much!

jacbier

I like this mod very much.

I installed the new version for SMF 1.1.1, but I get this message:

Not unique table/alias: 'pin'
Bestand: /home/a2642hob/public_html/forum/Sources/Load.php
Regel: 892

How do I fix this?

siath70

@Threepwud I think he fixed it with a new who flag file if not it sounds like my error just look at my post that is up a few. It should fix it.

Siath

clarkkent93

I'm trying to add the whoflags file and keep getting server errors: Premature end of script headers: index.php

I have no idea what's going on and I've tried several times to install this.  I had no problem installing the other files.

Let me know if anybody knows what I need to do.

Bernard
SMF 1.1.6

Threepwud

Thanks Siath and Gobalopper :)

Clarkkent93, do you have all files set to be 'all writable' from within the forum's options? Just a guess.

OK, so mine is now up (thanks!!!!!!!!!) but in the who.php page I'm seeing each flag listed THREE times. Anyone know if this is meant to be the case?

Need some code pasting in?

Thanks!

clarkkent93

#1111
Quote from: Threepwud on February 12, 2007, 07:16:29 PM
Thanks Siath and Gobalopper :)

Clarkkent93, do you have all files set to be 'all writable' from within the forum's options? Just a guess.

OK, so mine is now up (thanks!!!!!!!!!) but in the who.php page I'm seeing each flag listed THREE times. Anyone know if this is meant to be the case?

Need some code pasting in?

Thanks!

Thanks for everybody's help.  I updated the file so it wouldn't be rejected by 1.1.2 and so far so good. 

My next question is if I want to update the country database ie the csv file, how would I go about doing that?  Would I have to repackage the entire package to include the newer database?

I'm also wondering if this mod would be responsible for the following error I'm receiving: "Not unique table/alias: 'pin'
File: /home/www/riverside.doddemagen.com/Sources/Load.php
Line: 895"?  Any ideas?


Thanks again.

BTW, are there basic instructions on how to use this package ie how do I add the state?
SMF 1.1.6

clarkkent93

Quote from: Surferbird on October 07, 2006, 04:25:33 PM
This is solved, IGNORE this message!  ;)


Installed Gopaloppers location mod and now several messages and other functions gives this error when try to read them? My version is rc3
Any idea what to do?

Not unique table/alias: 'pin'
File: /home/xxxxxxx/public_html/xxxxxxxxx/forum/Sources/Load.php
Line: 875

How was this issue resolved?  This is the error message that I'm getting:
Not unique table/alias: 'pin'
File: /home/www/riverside.doddemagen.com/Sources/Load.php
Line: 895


I've tried uninstalling the package but that seems to mess things up even more.  Can anybody help?
SMF 1.1.6

Gobalopper

If you get those errors it likely means the code got duplicated during uninstall or install. Go back to the original version of the SMF source/theme files and try installing again.

clarkkent93

#1114
Quote from: Gobalopper on February 13, 2007, 04:23:40 PM
If you get those errors it likely means the code got duplicated during uninstall or install. Go back to the original version of the SMF source/theme files and try installing again.

I'm a noob (whew I said it!  :-[)  but can you explain that in more detail so I don't repeat the mistake again?  I had someone over at TinyPortal fix the problem for me (thanks IchBin!) but it would be good to know for next time.

Know that the error is fixed, I do have an honest question for you.  How do I get the flag to appear in the profile?

Again, the website is http://riverside.doddemagen.com
SMF 1.1.6

siath70

Quote from: Threepwud on February 12, 2007, 07:16:29 PM
Thanks Siath and Gobalopper :)

Clarkkent93, do you have all files set to be 'all writable' from within the forum's options? Just a guess.

OK, so mine is now up (thanks!!!!!!!!!) but in the who.php page I'm seeing each flag listed THREE times. Anyone know if this is meant to be the case?

Need some code pasting in?

Thanks!
Nope you should only see each flag once. Correct me if I'm wrong. It sounds to me like it got duplicated. If you want I can take a look at your code and see if I can fix it. Need the address for your board. I don't mean to step on Gobalopper toes, just trying to help if I can.


Siath

clarkkent93

SMF 1.1.6

kat

#1117
Go figure.

When I try to download the flags, from here:

http://www.simplemachines.org/community/index.php?action=dlattach;topic=20168.0;attach=26651

I get "You are not allowed to access this section."

Shame.

clarkkent93

Quote from: kat on February 15, 2007, 04:05:23 PM
Go figure.

When I try to download the flags, from here:

http://www.simplemachines.org/community/index.php?action=dlattach;topic=20168.0;attach=26651

I get "You are not allowed to access this section."

Shame.

If you're trying to get it from the download area, I received the same error.  You can download it from the topic itself.  It's in the very first one.  Just so you know there is a new ip database file as of January 2007.  The one in the download is old.  Just replace it.  You can get the web address for the file when you install the mod.  Good luck!
SMF 1.1.6

Gobalopper

Actually the IP database in the latest file is the new one from January.

And the link from the mod page should work now, it was going to a deleted version of the file before, thanks for pointing that out.

Advertisement: