News:

Wondering if this will always be free?  See why free is better.

Main Menu

Google Member Map

Started by vbgamer45, December 29, 2016, 12:59:42 PM

Previous topic - Next topic

Matthias

I have updated to the latest map version 3.0.6 at an 2.0.19 installation.

There is a litte bug:
8: Undefined index: cannot_googleMap_view
File: sources/security.php around line 910
906:// If they are a guest, show a login. (because the error might be gone if they do!)
907:if ($user_info['is_guest'])
908:{
909:loadLanguage('Errors');
==>910: is_not_guest($txt['cannot_' . $error_permission]);
911:}

The bug only affects guests. I think the GoogleMap.languages.php file is not loaded in this case. But the text string cannot_googleMap_view are located at this file.

To fix this, I have added cannot_googleMap_view text string to Modifications.languages.php
// Google Map Permissions
$txt['cannot_googleMap_view'] = 'Sorry, you are not allowed to view the Member Map.';

After doing that, the error message no longer occurs.
It's not a big deal but happens. ;)
Quality first

vbgamer45

Thanks have added in the latest update
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

landyvlad

I have this mod installed on 2.0.19.

I see its noted as compatible with 2.1RC3

With the release now of 2.1.0 is it compatible for use with no further changes necessary?
"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

Matthias

You can install this mod with the package manager. If you don't see any errors during installation, this should work.
Quality first

Louis

#224
I have mod v3.0.6a on SMF 2.1.1 on php 7.4 and get lots of "undefined index" errors, frequently followed by "Trying to access array offset on value of type null"

502: 8: Undefined index: image_href
528: 8: Undefined index: group_stars
536: 8: Undefined index: show_profile_buttons
592: 8: Undefined index: gender
594: 8: Undefined index: gender

And I am honestly a bit at loss how to fix all this. Some could for sure be caught by wrapping them in some if(isset($marker['...'])), but to me it looks as if I were lacking some options on the settings page :-\

Or am I missing something else?

[edit]
Anyway, this is what I changed to reduce the number of errors:
// groups stars
+ if (!empty($marker['group_stars'])) {
$datablurb .= '
<li class="stars">' . $marker['group_stars'] . '</li>';
+ }
// Show the profile, website, email address, and personal message buttons.
- if ($settings['show_profile_buttons'])
+ if (isset($settings['show_profile_buttons']))
{
+ if (isset($marker['gender'])) {
if ($marker['gender']['name'] == $txt['male'])
$markers .= 'gender="1"';
elseif ($marker['gender']['name'] == $txt['female'])
$markers .= 'gender="2"';
+ }
else
$markers .= 'gender="0"';
It is your mind that creates this world (Buddha)

vbgamer45

If you can list all the errors at line numbers for Trying to access array offset on value of type null I can take look
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Louis

Reverting the changes I already made in the meantime (see my edit above) it seems only the 'gender' throws 'Trying to access array offset on value of type null' in lines 592 and 594
It is your mind that creates this world (Buddha)

jacbier

Quote from: Louis on March 13, 2022, 11:53:00 AMI have mod v3.0.6a on SMF 2.1.1 on php 7.4 and get lots of "undefined index" errors, frequently followed by "Trying to access array offset on value of type null"

502: 8: Undefined index: image_href
528: 8: Undefined index: group_stars
536: 8: Undefined index: show_profile_buttons
592: 8: Undefined index: gender
594: 8: Undefined index: gender

And I am honestly a bit at loss how to fix all this. Some could for sure be caught by wrapping them in some if(isset($marker['...'])), but to me it looks as if I were lacking some options on the settings page :-\

Or am I missing something else?

[edit]
Anyway, this is what I changed to reduce the number of errors:
// groups stars
+ if (!empty($marker['group_stars'])) {
$datablurb .= '
<li class="stars">' . $marker['group_stars'] . '</li>';
+ }
// Show the profile, website, email address, and personal message buttons.
- if ($settings['show_profile_buttons'])
+ if (isset($settings['show_profile_buttons']))
{
+ if (isset($marker['gender'])) {
if ($marker['gender']['name'] == $txt['male'])
$markers .= 'gender="1"';
elseif ($marker['gender']['name'] == $txt['female'])
$markers .= 'gender="2"';
+ }
else
$markers .= 'gender="0"';

That is also the case on my forum.
Are all the bugs now fixed by the changes you made?

I'm not that good at modifying the php code. @vbgamer45 Will there be a fix for this mod?

Louis

#228
Quote from: jacbier on March 14, 2022, 06:13:39 AMAre all the bugs now fixed by the changes you made?
Well, splitting hairs I'd say they are not really fixed but somehow caught and do no longer fill the error log.  ;)

Except the "Undefined index: image_href" in line 502 the errors are all gone now.
And that one can ultimately be prevented by simply deleting lines 501 and 502 from GoogleMap.php:
<a href="' . $marker['online']['href'] . '">
<img src="' . $marker['online']['image_href'] . '" alt="' . $marker['online']['text'] . '" /></a>
It is your mind that creates this world (Buddha)

landyvlad

I installed on upgraded forum (test forum 2.1.1) and where the member map was, is now just a white patch of screen...?
"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

Shades.

I have this mod installed on 2.0.19 and 2.1.1.

On 2.0.19 the map is centered and works perfectly.

You cannot view this attachment.

On 2.1.1 the map is off to the right and bottom covering up the "There are (0) member pins on the map" text.

You cannot view this attachment.
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Shades.

Fixed in case anyone else has this issue:

In GoogleMap.template

Find: (Line 46)
                                            <div id="map" style="width: 675px; height: 500px;"></div>
Replace with:
                                            <div id="map" style="width: 650px; height: 480px;"></div>
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Shades.

Quote from: Louis on March 13, 2022, 11:53:00 AMI have mod v3.0.6a on SMF 2.1.1 on php 7.4 and get lots of "undefined index" errors, frequently followed by "Trying to access array offset on value of type null"

502: 8: Undefined index: image_href
528: 8: Undefined index: group_stars
536: 8: Undefined index: show_profile_buttons
592: 8: Undefined index: gender
594: 8: Undefined index: gender

And I am honestly a bit at loss how to fix all this. Some could for sure be caught by wrapping them in some if(isset($marker['...'])), but to me it looks as if I were lacking some options on the settings page :-\

Or am I missing something else?
I am having the same errors on 2.1.1 sadly! Hopefully it'll get updated for 2.1.1 because I really like this mod for my events forum! O:)
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

landyvlad

So.. for my issue (white area where google map should be) is there something I need to do with API or something?
Any ideas?
 
"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

Shades.

Quote from: landyvlad on March 28, 2022, 07:50:15 PMSo.. for my issue (white area where google map should be) is there something I need to do with API or something?
Any ideas?
 
I think you have to have a billing account with google if I remember correctly. Been a while since I set mine up but I think that was the cause of my white area. Once I created a billing account and set up my new API it showed up a couple days later.
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Matthias

#235
Concerns SMF 2.1.x
The user data is not displayed correctly or completely in the info bubble.
I am currently trying to change this.

In GoogleMap.php around line 500 I have changed this:
            // guest don't get to see this ....
            if (!$user_info['is_guest'])
            {
                $datablurb = '
        <div class="googleMap">
            <h4>
                <a href="' . $marker['online']['href'] . '">
                    <img src="' . $marker['online']['image_href'] . '" alt="' . $marker['online']['text'] . '" /></a>
                <a href="' . $marker['href'] . '">' . $marker['name'] . '</a>
            </h4>';

to this (taken from Display.template.php):
            // guest don't get to see this ....
            if (!$user_info['is_guest'])
            {
                $datablurb = '
        <div class="googleMap">';

            // Show online and offline buttons?
            if (!empty($modSettings['onlineEnable']) && !$marker['member']['is_guest'])
                $datablurb .= '               
                <h4>
                    ', $context['can_send_pm'] ? '<a href="' . $marker['online']['href'] . '" title="' . $marker['online']['text'] . '">' : '', $settings['use_image_buttons'] ? '<span class="' . ($marker['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $marker['online']['text'] . '"></span>' : $marker['online']['label'], $context['can_send_pm'] ? '</a>' : '', '
                </h4>';

I get a white page displayed. The error log on the server shows this:
Got error 'PHP message: PHP Parse error: syntax error, unexpected ',' in /var/www/vhosts/xxx/httpdocs/xxx/Sources/GoogleMap.php on line 505',

Line 505 is this:
', $context['can_send_pm'] ? '<a href="' . $marker['online']['href'] . '" title="' . $marker['online']['text'] . '">' : '', $settings['use_image_buttons'] ? '<span class="' . ($marker['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $marker['online']['text'] . '"></span>' : $marker['online']['label'], $context['can_send_pm'] ? '</a>' : '', '
I hope someone can tell me what is wrong with the code.
Quality first

Arantor

You can't use , to join things when you're not using echo, and that also messed with the ternary expressions.

Untested but I think you need this:

$datablurb .= '
<h4>
' . ($context['can_send_pm'] ? '<a href="' . $marker['online']['href'] . '" title="' . $marker['online']['text'] . '">' : '') . ($settings['use_image_buttons'] ? '<span class="' . ($marker['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $marker['online']['text'] . '"></span>' : $marker['online']['label']) . ($context['can_send_pm'] ? '</a>' : '') . '
</h4>';

Tonyvic

Quote from: Shades. on March 28, 2022, 12:35:34 PMFixed in case anyone else has this issue:

In GoogleMap.template

Find: (Line 46)
                                            <div id="map" style="width: 675px; height: 500px;"></div>
Replace with:
                                            <div id="map" style="width: 650px; height: 480px;"></div>

Thanks for the info @shades, can someone please help me to find GoogleMap.template as my brain is rather foggy. The only place I can see it is in the GoogleMap zip file.

Doug Heffernan

Quote from: Tonyvic on April 09, 2022, 09:42:39 AMcan someone please help me to find GoogleMap.template as my brain is rather foggy. The only place I can see it is in the GoogleMap zip file.

You will find said file inside the themes directory in your forum folder. That is if you have installed the mod.

If you have not installed the mod yet, you can make the edits to the file inside the mod package, save the changes and re-zip the mod again and then install it.

Tonyvic

Many thanks Doug,
I was stupidly looking in the directory for the theme I am using as I had totally forgotten that the default theme directory is the one. Huh.  :-[

Advertisement: