diff --git a/README.md b/README.md index 0e51162..f7a7b75 100644 --- a/README.md +++ b/README.md @@ -126,11 +126,11 @@ - end: 12h45 - len: 3h00 - begin: 15h15 - - mes: "" - - end: h - - len: 3h - - total: h - - money: € + - mes: "create plugin menu" + - end: 19h30 + - len: 4h15 + - total: 7h15 + - money: 217€50 #### total : 90 + 30 = 120€ diff --git a/srcs/plugins/map_prof/map_prof_hooks.php b/srcs/plugins/map_prof/map_prof_hooks.php index f2f1d0f..bf7a788 100644 --- a/srcs/plugins/map_prof/map_prof_hooks.php +++ b/srcs/plugins/map_prof/map_prof_hooks.php @@ -130,8 +130,8 @@ function post_published_coordinates($id, $post) { mp_console_log("location: "); mp_console_log($location); -// if ( ! add_post_meta( $id, 'location', $location, true ) ) -// update_post_meta( $id, 'location', $location ); + if ( ! add_post_meta( $id, 'location', $location, true ) ) + update_post_meta( $id, 'location', $location ); } add_action( 'publish_post', 'post_published_coordinates', 10, 2 ); diff --git a/srcs/plugins/map_prof/srcs/menu/mp_menu_content.php b/srcs/plugins/map_prof/srcs/menu/mp_menu_content.php index 76c8e42..9c64ee2 100644 --- a/srcs/plugins/map_prof/srcs/menu/mp_menu_content.php +++ b/srcs/plugins/map_prof/srcs/menu/mp_menu_content.php @@ -45,8 +45,6 @@ function mp_have_no_coordinates($posts_list) { $posts_no_coordinates = []; foreach ($posts_list as $post) { $location = get_field("location", $post->ID); - mp_console_log("location: "); - mp_console_log($location); if (empty($location)) array_push($posts_no_coordinates, $post); else if (empty($location->coordinates)) @@ -148,18 +146,18 @@ function mp_show_list_posts_no_coordinates($posts) { function ljdp_map_plugin_content() { $posts_list = mp_get_all_posts(); - mp_console_log("posts_list: "); - mp_console_log($posts_list); + //mp_console_log("posts_list: "); + //mp_console_log($posts_list); $posts_published = mp_posts_published($posts_list); $posts_no_address = mp_have_no_address($posts_list); - mp_console_log("posts_no_address: "); - mp_console_log($posts_no_address); + //mp_console_log("posts_no_address: "); + //mp_console_log($posts_no_address); $posts_no_coordinates = mp_have_no_coordinates($posts_list); - mp_console_log("posts_no_coordinates: "); - mp_console_log($posts_no_coordinates); + //mp_console_log("posts_no_coordinates: "); + //mp_console_log($posts_no_coordinates); echo << diff --git a/srcs/plugins/map_prof/srcs/publish/mp_get_coordinates.php b/srcs/plugins/map_prof/srcs/publish/mp_get_coordinates.php index 25c18d6..5741b9c 100644 --- a/srcs/plugins/map_prof/srcs/publish/mp_get_coordinates.php +++ b/srcs/plugins/map_prof/srcs/publish/mp_get_coordinates.php @@ -31,7 +31,11 @@ function mp_get_coordinates($id) { . '?language=fr' . '&address=' . urlencode($address) . '&key=' . $mp_api_key; + mp_console_log("geolocation:"); + mp_console_log($geolocation); $jsoncontent = file_get_contents($geolocation); + mp_console_log("jsoncontent:"); + mp_console_log($jsoncontent); // extract coordinates from json // https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types