Code Monkey home page Code Monkey logo

cmb_field_map's People

Contributors

berio avatar gyrus avatar lauravaq avatar mustardbees avatar pasqualevitiello avatar thekhorshed avatar yousan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cmb_field_map's Issues

Feature suggestion - possibility to save location data instead of just lat / lon

This extension serves you very well in a use case, where you save a point in the map in order to show it again in the frontend.

But what about the case, when you want to output certain information about the location in the frontend (maybe even without showing a google map) - street address, city, country...

Wouldn't it be useful to add the possibility to save certain pieces of address just like you can save lat / lon separately?

Map not rendering properly

The map is rendering inconsistently. (see image)

When first entering a location in the search field, the map does not render properly. However, after clicking "Save Post", the map does render properly. Then when re-opening the post for editing, the map again does not render properly.

Any guesses as to what's happening?
Note: there's currently only one other plugin activated, and it doesn't add any JS, so a conflict is improbable.
screen shot 2014-08-29 at 12 21 51 pm

API Key activated but maps asking for ownership

I have set up a new rules google cloud account because Im trying my theme on live server, I have generated API key, enqueued google-js with API key but I'm still getting in CMB2 form (Admin site) message "This page can't load Google Maps correctly" "Do you own this website?" After using Google Transition Tool result is positive and ownership is confirmed. I really don't know how to fix it. Can someone help me to sort it out?
I have tried
wp_enqueue_script('google_js','http://maps.google.com/maps/api/jskey=MY_API_KEY&sensor=false&callback=initMap')

wp_enqueue_script('google_js','//maps.googleapis.com/maps/api/jskey=MY_API_KEY&callback=initMap');

and other variations but no success. Before google new rules was all working fine If I cmd + click on link in enqueue_script it will run and open new window with google map loaded code.

Update: I have been on this issue spending all day. I can get maps only if I run web on terminal this mean http://192.168.1.1:8080/mywebsite and maps are running even without enqueueing google map script. Hmm. Anyway on localhost:8888/ and live server maps are not working at all. I have two different API Keys, one for live server and one for local dev. I find that maps.google.com is old call of v2 so Im using only googleapis.com .
wp_enqueue_script('google-maps', '//maps.googleapis.com/maps/api/js?key=MYAPIKEY');

Idea to customize URL

It is interesting to use constant in URL, this allows me to change or custom by the theme

E.g.:

public function __construct() {
        if ( ! defined( 'PW_CMB2_Field_Google_Maps_URL' ) ) {
            define( 'PW_CMB2_Field_Google_Maps_URL', plugin_dir_url( __FILE__ ) );
        }
        add_filter( 'cmb2_render_pw_map', array( $this, 'render_pw_map' ), 10, 5 );
        add_filter( 'cmb2_sanitize_pw_map', array( $this, 'sanitize_pw_map' ), 10, 4 );
    }
public function setup_admin_scripts() {
        wp_register_script( 'pw-google-maps-api', '//maps.googleapis.com/maps/api/js?sensor=false&libraries=places', null, null );
        wp_enqueue_script( 'pw-google-maps', PW_CMB2_Field_Google_Maps_URL . 'js/script.js', array( 'pw-google-maps-api' ), self::VERSION );
        wp_enqueue_style( 'pw-google-maps', PW_CMB2_Field_Google_Maps_URL . 'css/style.css', array(), self::VERSION );
    }

Is Repeatable?

Hello,

I just discovered this field and want to know if this field supports use in Group. Is this field Repeatable? Documentation of this field does not reveal this info, hence asking.

Waiting for your reply...

Cheers,

Ruturaaj.

How installation?

Hi
i have not understand how install, i have read in documentation i must install like a normal plugin....but i have already cmb2, maybe i must put your folders into cmb2's folder? If yes where...
Thx

Field Type

Hi i cant find any documentation that tells me exactly wich is the type of field that defines the map

        array(
            'name' => 'Mapa',
            'desc' => 'Especifica con detalle la dirección del comercio',
            'id'   => $prefix . 'direccion2',
            'type' => '???',
        ),

I have a question about Lisence

I use cmb_field_map plugin for my theme to sale. I was edit cmb_field_map (add more hidden field). Can i include it to my theme?

Option for not passing values to post

I added cmb_field_map to pages, where to goal was to have the option for some pages to show a map. The pages in question are not known beforehand so I need a way to check if the be rendered or not. Since once attached to pages all pages will have coordinates information (when saving), are you planning on adding a switch to control this?

I can easily do it with another cmb2 field for hiding the information in the front-end, but im just wondering if there's a cleaner approach to that.

Thanks.

Idea: Change location placeholder

Change the placeholder for 'location' from 'enter a location' to something a little more detailed. i.e. 'enter an address / postcode / lat long'.

I had no idea what type of format this was expecting.

[Feature request] Adding reverse geocoding support for ".map-search" input box

So far the input box above the map serves to search for a place's latidude and longitude.

To make the plugin even easier and more flexible to use,

  1. it would be great that when moving the map pointer, the input box could return the name of the new location.
  2. Similarly, when editing previously created metabox data, input box could contain the saved location's name instead of a default placeholder.

To achieve the first point, I found this script example that may be useful (see source code) http://www.geocodezip.com/v3_GoogleEx_geocoding-reverse2postcodeA.html [found through http://stackoverflow.com/questions/17830686/how-to-get-city-from-coordinates]

For the second point, location name's metadata could be saved and loaded through another hidden input field, to avoid another external request.

Well I have never used GoogleMaps API so far, and can't adapt geocodezip.com's straight away. I'll see if I can submit something later on.

Adoption

Hey,

Are you continuing to support this project, is there something I can help with?

Jordan

Update latitude & longitude value based on custom field

I'm sure you're busy, but thought you'd be the best person to ask for help! Hope that's okay!

I'm trying to take the CMB_Field_Map and tie it into a Gravity Forms. I've created a form where the user has the ability to drop a pin onto a map. Those map coordinates are then passed into a new post (set to draft/pending review of course). I've confirmed that Gravity forms is passing the value of the input to the appropriate entry in the DB (location_latitude & location_longitude), as the front end map tied to cmb_field_map shows the new entry immediately.

The issue I'm having is that unfortunately, in the post editor of the recently submitted map coordinates, the cmb_field_map doesn't update the pin according to the custom field location_latitude and location_longitude.

I've changed "hidden" to "text" on the lat / long inputs in cmb_field_map.php, and they too aren't being populated with the custom field location_latitude and location_longitude.

Is there any way to have those hidden fields along with the editor map check to see if the custom fields tied to them have been changed, and show the coordinates based on the location_latitude and location_longitude field, rather than simply being empty?

I'm assuming the google map would have to check the hidden (lat/long) fields and update based on those fields, and those fields would have to get the $wpdb entry for the custom fields. Unfortunately my backend tweaks are pretty limited, so any help or points in the right direction would be greatly appreciated!

Thanks again for the great plugin!

Google Map not shown correctly in Bootstrap modal

i have a form inside a bootstrap modal to create posts from the frontend. The google map field works not correctly only inside the modal. The map is not displaying and autocomplete is also not working.

Any ideas?

google_map_modal

Render the map from the administrator's settings page.

Hello everyone, I have not had any problem to get the latitude and longitude from a CPT reading all your comments and the problems that arose.

But when it comes to wanting to get those coordinates from a map that is located on an administrator page that i created, i'm not able to.

I have tried it this way, and it returns a blank space:

$mapGPSlat = myprefix_get_option('location-ga_latitude');

$mapGPSlong = myprefix_get_option('location-ga_longitude');

I hope you can help me.

A greeting.

Bug: same ID for lat/long input fields

Hi,

Really love this class - however, there is a small bug: when split_values=true, the two input (hidden) fields created for latitude and longitude receive the exact same ID. This is not allowed in HTML - but worse, it prevents using these fields for various additional JavaScript validations, extrapolations, etc.

I solved this by editing cmb-field-map.php and adding 'id' => $field->args( 'id' ) . '_longitude' (for example) to the $field_type_object->input array... so it's a simple fix...

Thanks,

Bira

Doesn't work inside a theme

I'm trying to put it inside theme but doesn't work.

CMB works ok.
Others metaboxes are showing fine.

This one doesn't show map and reviewing with Firebug find this error inside script.js called:
You don't have permission to access ...addresstomytheme.../inc/metaboxes/cmb_field_map/js/script.js
on this server.

When I comment this line define( 'PW_GOOGLE_MAPS_URL', plugin_dir_url( FILE ) ); and replace by define( 'PW_GOOGLE_MAPS_URL', trailingslashit( get_stylesheet_directory_uri() . '/inc/metaboxes/cmb_field_map/cmb-field-map.php' ) );

I found this error: Fatal error: Call to undefined function add_filter() in ...addresstomytheme...\inc\metaboxes\cmb_field_map\cmb-field-map.php on line 30

Add composer repository

Hi,

Since this plugin isn't in w.org plugin repository, it can't be used with composer and wpackagist.org mirror. Composer repo would be awesome, and it's simple to made with packagist.

Forked and updated plugin

I have forked the plugin at https://github.com/gareth-gillman/cmb_field_map and extended it with:

  • options page to add the api key
  • on the meta box, checks if the api key is inputted

I am also going to hook into Google API key and check if the key is valid before saving to the DB (if I can).

Happy to pull request if Phil wants it in his plugin, using it on my own project so thought be useful to others since the google api change

Unable to save coordinates in repeatable groups

Hello there,

I am currently using your custom field inside repeatable groups but it is unable to save coordinates. Would you please help me to figure out how to fix the issue?

Cheers,
-P

Set default map location

Would it possible to add that it's possible to set default map location my wordpress filters or something? Now the default view is UK. I looked the code and if I understood correctly now it just set in js file, right?

How to embed plugin inside theme folder?

Hi, great plugin.

Is there any way to embed this plugin inside theme folder?
In functions.php I try to add this:
require get_template_directory() . '/cmb-field-map/cmb-field-map.php';
and put the folder inside theme directory but the map doesn't work. I only saw the input field (it's not working if I type something).

Is it possible to add the plugin folder inside theme folder and call it from functions.php? Just like CMB2.

Thanks in advance

Global var issue when using the script through a manual require_once rather than as a WP plugin

Hi,

Thank you for this useful plugin.
If I am not missing something, I suggest adding the following to the readme file.

When adding cmb_field_map folder to - let's say - "my_theme_folder/cmb_plugins/", only setting a require_once order would not be sufficient as the JS & CSS files won't be enqueued properly.

Indeed, the following constant points towards WP's plugins folder.

// Useful global constants
define( 'PW_GALLERY_URL', plugin_dir_url( __FILE__ ) );

Source: https://github.com/mustardBees/cmb_field_map/blob/master/cmb-field-map.php#L12-13

Instead, I would need to define it this way in my case:

// Useful global constants
define( 'PW_GALLERY_URL', get_bloginfo('template_directory') . '/cmb_plugins/cmb-field-map/ );

NB: This is also applicable to your other CMB plugins.

Best

Does not work with term meta + split_values

The plugin works great with CMB2 boxes on posts (need to use PR #45 + an api key), but it does not work with CMB2 boxes on terms. The value does not save.

The map also loads very narrow:
https://cloudup.com/cmXV7hN-IZP

EDIT: Turns out, it's setting split_terms to true that's not updating the split values. It works fine when split_values is false.

Installation Guide

Can you provide 2 lines installation guide for this plugin?

I load cmb2 through my theme folder.

require_once 'cmb2/init.php';

and the cmb_field_map as a plugin in the plugin directory.

I put the pw_map field but is not working. I notice that the cmb_field_map js and css files is not being loaded so I am wondering if I am missing something with the installation.

Thanks in advance

front end : add cmd_field_map to an address field

Hi guys!
Great plugin mustardBees, I use it on all my wordpress projects related to an address somehow.

For my current project, I need people to add a custom post type object via the front-end.
They'll be able to add their car for rent online. I'd love to use your plugin in this front-end part as well so the user can select his address easily.

How can I do that?
Thanks!

add support for 'required' attribute

Adding the 'required' attribute doesn't affect this field. :(

    // Event Coordinates
    $bo_open->add_field( array(
        'name' => __('Event Mapping Location', 'bo_cmb2' ),
        'desc' => __('Regardless of the number of properties, pick a spot on the map to represent the "center" of your event)', 'bo_cmb2' ),
        'id' => $prefix . 'location',
        'type' => 'pw_map', //only does lat+long, per https://github.com/mustardBees/cmb_field_map/issues/22
        'split_values' => true, // Save latitude and longitude as two separate fields
        'attributes'  => array(
            'required'    => 'required',
        ),
    ) );

refresh map from select value

This is an automatic translation
Hello,
I inserted under the field of the map ('type' => 'pw_map') with a select zoom values.

How do I update the map when the value of the select?
Thank you_

API Key Is required?

API Key Is required in our instance. I was able to fix this by hardcoding the API key in the Google Maps script enqueue. It might behooves to add this as an option or setting in the admin :)

Delete or Reset field

Once created and set the location in the map i cannot find the way to reset the field.

Thank you very much!!

CMB2 - is it compatible?

hi, is this field ready to go with CMB"?

array(
'name' => 'Location',
'desc' => 'Drag the marker to set the exact location',
'id' => $prefix . 'location',
'type' => 'pw_map',
'sanitization_cb' => 'pw_map_sanitise',
),

i use the above field declaration and the field is empty, do I need to adjust something?

Marker not showing

Hi,

Thanks for nice plugin

I found that marker is not showing

by editing script.js line 39 to

`

           marker.setPosition( latLng );

	if ( latitude.val().length > 0 && longitude.val().length > 0 ) {
		//marker.setPosition( latLng );
	}

`

make it working

I hope this help

Thanks

Search by GPS coordinates or mouse click

I'm missing two things on this field.

  1. I don't know what "name" I'm looking for but I know where it is, so I want just click on the map and where I click are the final GPS coordinates
  2. Option to search by GPS coordinates.. In one post I want to search by street name, in second post I know the right GPS..
    looking forward for your answer and thanks for this briliant field :)

Install issue

Fatal error: Cannot redeclare class PW_CMB2_Field_Google_Maps in /home/site/public_html/wp-content/plugins/cmb_field_map-master/cmb-field-map.php on line 16.

Point out of center when map is in hidden div

Hi,

I really love your pluign, hope @jaredatch include your code in the framework :)

Ok, this is my problem. I have the map inside a hidden div, is a tab actually, so when I click in the tab where the map is the "point" of the location is not in the center it moves to the top-left corner of the iframe, searching for a solution I found this script: http://stackoverflow.com/questions/4528490/google-map-v3-off-center-in-hidden-div
But seams do not work, any idea of how can I fix this?

Thanx.

Documentation on Usage

I use CMB often as it is one fantastic web development tool for WordPress. I just learned that there are third party resources. I know how to include the array for the map in example-functions.php (which will be of course renamed), but where should I put the files such as cmb-field-map.php, the css and js folders? On the same level as the CMB folder?

First post map are showing but next post map are not showing

In my first post map are showing exactly but the next post map are not showing// please help me..waiting for your positive response.
thanks
screenshot_2

my map coding in (index.php): -

		<script>
		<?php $maddr = get_post_meta(get_the_ID(),'event_map',true);?>
	    function initMap() {
			var myLatLng = {lat: <?php echo $maddr['latitude']; ?>, lng: <?php echo $maddr['longitude']; ?>};

			var map = new google.maps.Map(document.getElementById('map'), {
			  zoom: 10,
			  center: myLatLng
			});

			var marker = new google.maps.Marker({
			  position: myLatLng,
			  map: map,
			  title: '<?php echo the_title();?>'
			});
		  }
		</script>
		<script async defer
			src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAh4eG0CZSzobg49GlkbM1Cvsammyz7hSg&callback=initMap">
		</script>

cmb2 coding: -
$eventsfield -> add_field(array(
'name' => 'Event Location In Map',
'id' => 'event_map',
'type' => 'pw_map',
'split_values' => true,
));

Front End Documentation

Just wondering if you could provide additional documentation for the front end. I saw one method submitted in a closed issue, which appeared to work for mapping a single point. I would love to see how you might use this in a query to show multiple points on a map.

Great addition, love what you've done!

Setting the starting point

I wish i had time and knowledge to fork this to add a setting page or something like that to provide the possibility to define the starting point of the map (currently UK). For now i'll just modify the file ^^

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.