Jump to content

Community

Member Map


Martin A.

Recommended Posts

Is it possible to add another table column to the Member Map application based on member id? 

I want to add core_pfields_content -> field_1

I inserted another hook but all I get is the table core_pfields_data when I try.

 

try
			{
				$groupId = $this->getMemberGroupId();

				$db = \IPS\Db::i()->select( '*', array( 'membermap_markers', 'mm' ), array( 'mm.marker_member_id=? AND mm.marker_parent_id=?', intval( $memberId ), intval( $groupId ) ) );

				$memberPfield = \IPS\core\ProfileFields\Field::load( $memberId );
				error_log(print_r($memberId,true));
				error_log(print_r($memberPfield->data,true));
				
				if ( $loadMemberdata )
				{
					$db->join( array( 'core_members', 'm' ), 'mm.marker_member_id=m.member_id' );
					$db->join( array( 'core_groups', 'g' ), 'm.member_group_id=g.g_id' );
				}
				
				$_marker = $db->first();

				if ( ! $format OR ! $loadMemberdata )
				{
					$_marker = \IPS\membermap\Markers\Markers::constructFromData( $_marker );
				}

				$marker[ $memberId . '-' . ( $format ? '1' : '0' ) ] = $_marker;
						
			}

 

Any help here would be appriciated!

Link to comment
Share on other sites

17 hours ago, Thomas Hop said:

Is it possible to add another table column to the Member Map application based on member id? 

I want to add core_pfields_content -> field_1

I inserted another hook but all I get is the table core_pfields_data when I try.

 

Any help here would be appriciated!

Hi,

You can add that table as a DB join.

$db = \IPS\Db::i()->select( '*', array( 'membermap_markers', 'mm' ), array( 'mm.marker_member_id=? AND mm.marker_parent_id=?', intval( $memberId ), intval( $groupId ) ) );
$db->join( array( 'core_ofields_content', 'pc' ), 'mm.marker_member_id=pc.member_id' );

 

Link to comment
Share on other sites

Yes that did add the table to $markers. When I print it inside the file: 

try
            {
                $groupId = $this->getMemberGroupId();

                $db = \IPS\Db::i()->select( '*', array( 'membermap_markers', 'mm' ), array( 'mm.marker_member_id=? AND mm.marker_parent_id=?', intval( $memberId ), intval( $groupId ) ) );

                
                if ( $loadMemberdata )
                {
                    $db->join( array( 'core_members', 'm' ), 'mm.marker_member_id=m.member_id' );
                    $db->join( array( 'core_groups', 'g' ), 'm.member_group_id=g.g_id' );
                    $db->join( array( 'core_pfields_content', 'pc' ), 'mm.marker_member_id=pc.member_id' ); 
                    
                }
                
                $_marker = $db->first();
                
            
                
                if ( ! $format OR ! $loadMemberdata )
                {
                    $_marker = \IPS\membermap\Markers\Markers::constructFromData( $_marker );
                }

                $marker[ $memberId . '-' . ( $format ? '1' : '0' ) ] = $_marker;
                        error_log(print_r($marker,true));
            }
            catch( \UnderflowException $e )
            {
                return false;
            }
        }

However when I print $markers inside the template popupContent there are only like 25 items left of the array. What am I missing here?

Knipsel1.PNG

Knipsel2.PNG

Knipsel3.PNG

Link to comment
Share on other sites

On 8/6/2018 at 11:48 AM, Thomas Hop said:

Yes that did add the table to $markers. When I print it inside the file: 

However when I print $markers inside the template popupContent there are only like 25 items left of the array. What am I missing here?

Hello,

What you're missing here is that popup content is loaded with AJAX (this was done to reduce the size of the cache). See \IPS\membermap\modules\front\membermap\ajax getPopup().

You can do this in the template:

{{if $marker->container()->type == 'member'}}
	{{$profileFields = $marker->author()->contentProfileFields();}}
	{{error_log( print_r( $profileFields, 1 ) );}}
{{endif}}

 

Link to comment
Share on other sites

On 8/12/2018 at 8:24 AM, Martin A. said:

Hello,

What you're missing here is that popup content is loaded with AJAX (this was done to reduce the size of the cache). See \IPS\membermap\modules\front\membermap\ajax getPopup().

You can do this in the template:


{{if $marker->container()->type == 'member'}}
	{{$profileFields = $marker->author()->contentProfileFields();}}
	{{error_log( print_r( $profileFields, 1 ) );}}
{{endif}}

 

Hey Martin,

Been a bit inactive for a few days but I have seen your post and I will check up on it when I have the time!

 

Thanks a lot!

Link to comment
Share on other sites

  • 2 weeks later...
21 minutes ago, derpunker said:

Hello,

is there any reason why this extension is based on MapQuest and not on the OpenStreetMap API?

The OpenStreetMap API provides all the required information and doesn't need a registration.
https://wiki.openstreetmap.org/wiki/Nominatim
https://wiki.openstreetmap.org/wiki/Static_map_images (http://staticmap.openstreetmap.de/)

Because their Nominatim policy does not allow the kind of usage Member Map require. And when I initially developed this 3 years ago, I used a different API endpoint at MapQuest. If I remember correctly, there was also a difference in the results from OSM Nominatim and MapQuest Nominatim, where the latter was far better at getting addresses. This may of course have changed over the years.

https://operations.osmfoundation.org/policies/nominatim/

Quote
  • No heavy uses (an absolute maximum of 1 request per second).

....

  • Auto-complete search This is not yet supported by Nominatim and you must not implement such a service on the client side using the API.

And they're not happy about automated bulk requests, which the profile sync feature would violate.

 

Link to comment
Share on other sites

Hi Martin,

thanks for your quick answer.
Unfortunately you are absolutly right. I read the policies / licence of the OpenStreetMap maps but not of nominatim. My fault 😞

 

Another question:
Is there a way to customize the scroll / resize behavior? The initial setMapHeight is absolutly great, but I want to disable the behavior for scrolling and resizing?
The scrolling behavior makes the map a little bit hard to use on a smartphone (e.g. getting to the community footer).

I reviewed the javascript code and found no setting. My first (and currently only) idea is to write a template hook and rename the ID of the div element.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
10 hours ago, .Ian said:

Just upgraded to the latest version. 

All looks fine, except all the pins are doubled. I have two of each slightly apart.

Any suggestions?

Are the markers duplicated in the database too? Click Browse Markers, and have a look. If they're not this is a cache issue. Rebuild both server and browser cache.

Link to comment
Share on other sites

59 minutes ago, Martin A. said:

Are the markers duplicated in the database too? Click Browse Markers, and have a look. If they're not this is a cache issue. Rebuild both server and browser cache.

Show twice in browse markers. So I assume I am safe to delete from the Browse Markers section? 

Edited by .Ian
Link to comment
Share on other sites

5 minutes ago, .Ian said:

Show twice in browse markers. So I assume I am safe to delete from the Browse Markers section? 

That's weird. I see that it appears as if all markers were added 12 hours ago too, is that correct? Have you done any imports or anything? What version did you upgrade from?

Yes, you can delete the duplicated markers from that section.

Link to comment
Share on other sites

3 minutes ago, .Ian said:

I am going to say 3.4.6 - it was 5 years old that is all I know!  

Just ran the upgrade .

I'll delete from there.  Thanks 🙂

Oh, so you upgraded the whole software from 3.4.6 yesterday? Or you upgraded/installed Member Map and it took the marker data from a 3.4.6 database/table? That can explain any weirdness.

Link to comment
Share on other sites

1 minute ago, Martin A. said:

Oh, so you upgraded the whole software from 3.4.6 yesterday? Or you upgraded/installed Member Map and it took the marker data from a 3.4.6 database/table? That can explain any weirdness.

Both. 

IPS upgraded for me, then I am upgrading the apps. 

Some are fine, others are failing big time and some have the odd issues. 

Incidentally when I ticked and unticked various people, whilst the number of items being selected didn't alter, the number to confirm that I wanted to delete was much higher.  

Link to comment
Share on other sites

Hello,

After upgrading my IPS self hosted instance to 4.3.6 and member map application to the latest version 3.5.2, I'm experiencing issues with rebuilding member map cache cron job being stuck. 

608684102_ScreenShot2018-09-30at10_18_28AM.thumb.png.e423210bef1df8016900269ff8897b89.png

I did run them manually, but again it gets stuck on the next cron job. It also blocks other cron jobs to perform...

Also, my member map shows 0 markers.

Please let me know what should I check/do.

Thanks!

Ivan

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy