I am trying to create a directory using the connections plugin that has only business name, phone number and a Map for each entry. To do this I am trying to specify the map location using the latitude and longitude fields only. However, if I do not put something in the Address fields, I get an error above the map that says:
implode() [function.implode]: Invalid arguments passed in /home/wmaster1/public_html/BD/wp-content/plugins/connections/includes/class.output.php on line 855
The maps code in the class.output.php file is:
[php]
803 $out = ‘’;
804 $attr = array();
805 $geo = array();
806
807 // Limit the map type to one of the valid types to prevent user error.
808 $permittedMapTypes = array( ‘HYBRID’, ‘ROADMAP’, ‘SATELLITE’, ‘TERRAIN’ );
809 $atts[‘maptype’] = strtoupper( $atts[‘maptype’] );
810 if ( ! in_array( $atts[‘maptype’] , $permittedMapTypes ) ) $atts[‘maptype’] = ‘ROADMAP’;
811
812 // Limit the user specified zoom level to between 0 and 21
813 if ( ! in_array( $atts[‘zoom’] , range(0, 21) ) ) $atts[‘zoom’] = 13;
814
815 // Ensure the requested map size does not exceed the permitted sizes permitted by the Google Static Maps API
816 if ( $atts[‘static’] ) $atts[‘width’] = ( $atts[‘width’] <= 640 ) ? $atts[‘width’] : 640;
817 if ( $atts[‘static’] ) $atts[‘height’] = ( $atts[‘height’] <= 640 ) ? $atts[‘height’] : 640;
818
819 $addresses = $this->getAddresses( $atts , $cached );
820
821 if ( empty($addresses) ) return ‘’;
822
823 if ( ! empty($addresses[0]->line_one) ) $addr[] = $addresses[0]->line_one;
824 if ( ! empty($addresses[0]->line_two) ) $addr[] = $addresses[0]->line_two;
825 if ( ! empty($addresses[0]->city) ) $addr[] = $addresses[0]->city;
826 if ( ! empty($addresses[0]->state) ) $addr[] = $addresses[0]->state;
827 if ( ! empty($addresses[0]->zipcode) ) $addr[] = $addresses[0]->zipcode;
828
829 if ( ! empty($addresses[0]->latitude) && ! empty($addresses[0]->longitude) )
830 {
831 $geo[‘latitude’] = $addresses[0]->latitude;
832 $geo[‘longitude’] = $addresses[0]->longitude;
833 }
834
835 if ( empty($addr) && empty($geo) ) return ‘’;
836
837 if ( $atts[‘static’] )
838 {
839 $attr[‘center’] = ( empty($geo) ) ? implode( ‘, ’ , $addr ) : implode( ‘,’ , $geo );
840 $attr[‘markers’] = $attr[‘center’];
841 $attr[‘size’] = $atts[‘width’] . ‘x’ . $atts[‘height’];
842 $attr[‘maptype’] = $atts[‘maptype’];
843 $attr[‘zoom’] = $atts[‘zoom’];
844 //$attr[‘scale’] = 2;
845 $attr[‘format’] = ‘png’;
846 $attr[‘sensor’] = ‘false’;
847
848 $out .= ‘’;
849 $out .= ‘’;
850 $out .= ‘’;
851 }
852 else
853 {
854 $attr[] = ‘id="map-’ . $this->getRuid() . ‘"’;
855 $attr[] = ‘data-address="’ . implode(’, ‘, $addr) .’"’;
856 if ( ! empty($geo[‘latitude’]) ) $attr[] = ‘data-latitude="’ . $geo[‘latitude’] .’"’;
857 if ( ! empty($geo[‘longitude’]) ) $attr[] = ‘data-longitude="’ . $geo[‘longitude’] .’"’;
858 $attr[] = ‘style=“width: ’ . $atts[‘width’] . 'px; height: ’ . $atts[‘height’] . 'px”’;
859 $attr[] = ‘data-maptype="’ . $atts[‘maptype’] . ‘"’;
860 $attr[] = ‘data-zoom="’ . $atts[‘zoom’] . ‘"’;
861
862 $out = ‘<div ’ . implode(’ ', $attr) . ‘>’;
863 }
864
865 if ( $atts[‘return’] ) return ( “\n” . ( empty( $atts[‘before’] ) ? ‘’ : $atts[‘before’] ) ) . $out . ( ( empty( $atts[‘after’] ) ? ‘’ : $atts[‘after’] ) ) . “\n”;
866 echo ( “\n” . ( empty( $atts[‘before’] ) ? ‘’ : $atts[‘before’] ) ) . $out . ( ( empty( $atts[‘after’] ) ? ‘’ : $atts[‘after’] ) ) . “\n”;
867 }
868 [/php]
I am currently using the latest versions of WordPress and Connections. What can I do to clear this error and keep the Address field from showing in the directory?
Thank you in advance for your help!
Plugins: