Basically, I would like to add a Label to my marker card, which returns the number of my BuddyPress members in place (just the number that MarkerClusterer produces), and when I click on it, it redirects to a specific URL.
In addition, I would like to set up MarkerClusterer to add these numbers together, instead of counting the number of tokens that I have.
Problem : I’m struggling to set up the features included in the Progress Map plugin , and the developer of this, apparently, does not bother with dirty hands.
In any case, this is the result. I would like ( white marks in red dots):

I found a way to get the number of my members at each location using the following code:
<?php global $bp;
if ( bp_has_members( bp_ajax_querystring( 'members' ). '&per_page='.sq_option('buddypress_perpage') ) ) :
$region = array();
while ( bp_members() ) : bp_the_member();
$region[] = xprofile_get_field_data( 'Region' , bp_get_member_user_id() );
endwhile;
endif; ?>
Here is the call to create an object marker :
var marker_object = cspm_new_pin_object(<?php echo $l; ?>, '<?php echo $post_id; ?>', <?php echo $lat; ?>, <?php echo $lng; ?>, '<?php echo $implode_post_categories; ?>', map_id, '<?php echo $marker_img_by_cat; ?>', '<?php echo $marker_img_size; ?>', '<?php echo $is_child; ?>');
json_markers_data.push(marker_object);
And here is the cpsm_new_pin_object function (I assume the Google Maps API is used here):
function cspm_new_pin_object(i, post_id, lat, lng, post_categories, map_id, marker_img, marker_size, is_child){
var map_script_id = (typeof progress_map_vars.map_script_args[map_id] !== 'undefined') ? map_id : 'initial';
post_lat_lng_coords[map_id][post_id] = lat+'_'+lng;
post_lat_lng_coords[map_id]['post_id_'+post_id] = {};
post_ids_and_child_status[map_id][lat+'_'+lng] = is_child;
var post_category_ids = (post_categories != '') ? post_categories.split(',') : '';
post_lat_lng_coords[map_id]['post_id_'+post_id][0] = post_category_ids;
var marker_icon = '';
if(progress_map_vars.map_script_args[map_script_id]['defaultMarker'] == 'customize'){
var marker_cat_img = marker_img;
var marker_img_width = (progress_map_vars.map_script_args[map_script_id]['retinaSupport'] == "true") ? parseInt(marker_size.split('x')[0])/2 : parseInt(marker_size.split('x')[0]);
var marker_img_height = (progress_map_vars.map_script_args[map_script_id]['retinaSupport'] == "true") ? parseInt(marker_size.split('x')[1])/2 : parseInt(marker_size.split('x')[1]);
var anchor_y = marker_img_height/2;
var anchor_x = marker_img_width/2;
var anchor_point = null;
if(progress_map_vars.map_script_args[map_script_id]['marker_anchor_point_option'] == 'auto')
anchor_point = new google.maps.Point(anchor_x, anchor_y);
else if(progress_map_vars.map_script_args[map_script_id]['marker_anchor_point_option'] == 'manual'){
if(progress_map_vars.map_script_args[map_script_id]['retinaSupport'] == "true"){
anchor_point = new google.maps.Point(
progress_map_vars.map_script_args[map_script_id]['marker_anchor_point'].split(',')[0]/2,
progress_map_vars.map_script_args[map_script_id]['marker_anchor_point'].split(',')[1]/2
);
}else anchor_point = new google.maps.Point(progress_map_vars.map_script_args[map_script_id]['marker_anchor_point'].split(',')[0], progress_map_vars.map_script_args[map_script_id]['marker_anchor_point'].split(',')[1]);
}
marker_icon = new google.maps.MarkerImage(marker_cat_img, null, null, anchor_point, new google.maps.Size(marker_img_width,marker_img_height));
}
return pin_object = {latLng: [lat, lng], tag: 'post_id__'+post_id, id: post_id+'_'+is_child, options:{ optimized: false, icon: marker_icon, id: post_id, post_id: post_id, is_child: is_child }};
}
Arriving, of course, in my version of minify :
cspm_new_pin_object(e,s,a,r,t,i,o,_,p){var n="undefined"!=typeof progress_map_vars.map_script_args[i]?i:"initial";post_lat_lng_coords[i][s]=a+"_"+r,post_lat_lng_coords[i]["post_id_"+s]={},post_ids_and_child_status[i][a+"_"+r]=p;var c=""!=t?t.split(","):"";post_lat_lng_coords[i]["post_id_"+s][0]=c;var m="";if("customize"==progress_map_vars.map_script_args[n].defaultMarker){var l=o,d="true"==progress_map_vars.map_script_args[n].retinaSupport?parseInt(_.split("x")[0])/2:parseInt(_.split("x")[0]),u="true"==progress_map_vars.map_script_args[n].retinaSupport?parseInt(_.split("x")[1])/2:parseInt(_.split("x")[1]),g=u/2,f=d/2,v=null;"auto"==progress_map_vars.map_script_args[n].marker_anchor_point_option?v=new google.maps.Point(f,g):"manual"==progress_map_vars.map_script_args[n].marker_anchor_point_option&&(v="true"==progress_map_vars.map_script_args[n].retinaSupport?new google.maps.Point(progress_map_vars.map_script_args[n].marker_anchor_point.split(",")[0]/2,progress_map_vars.map_script_args[n].marker_anchor_point.split(",")[1]/2):new google.maps.Point(progress_map_vars.map_script_args[n].marker_anchor_point.split(",")[0],progress_map_vars.map_script_args[n].marker_anchor_point.split(",")[1])),m=new google.maps.MarkerImage(l,null,null,v,new google.maps.Size(d,u))}return pin_object={latLng:[a,r],label:'B',tag:"post_id__"+s,id:s+"_"+p,options:{optimized:!1,icon:m,id:s,post_id:s,is_child:p}}}
To summarize , 2 or 3 things:
- Be able to insert a label (counter) inside my red dots (markers)
- Setting up the MarkerClusterer plugin to display the total number of other counters (dynamically if we are unzoom) instead of the number of markers inside it.
- () (?) WP "Post" ( ACF).
: https://spanishblackgarlic.com/spanishblackgarlic/