• Resolved Jan-Philipp

    (@pogstar)


    Hello.

    I am using

    WordPress V4.2.4
    Geo Mashup v1.8.4
    Geo Mashup Custom Plugin (latest)
    Google Maps v3
    Advanced Custom Fields Pro

    I build with ACF a custom user profile form with address fields and radio buttons to choose what type of business the user has (f.e. fashion, furniture, etc.)

    The addresses are correctly shown on a global map, but i cannot bring the custom markers to work which are based on the business type custom field ‘imagetype’.

    I build the code based on following example:
    https://sites.google.com/site/geomashupwiki/guides/custom-marker-depending-on-a-custom-field-value

    I have a discussion about this on WP Qustions.

    Andrea P. came up with this code for the functions, but it still does not work. Maybe you have an idea, how to solve this.
    Andreas function code is:

    function my_geo_mashup_locations_json_filter( $json_properties, $queried_object  ) {
    
        global $wp_query;
    
        $looped_user = $wp_query->get_queried_object();
    
        $imagetype =  get_field ( 'imagetype', 'user_'.$looped_user->ID);
    
        if ( $imagetype == 'fashion' ) {
    
          $json_properties['my_complete'] = 1;
    
       } else if ( $imagetype == 'furniture' ) {
    
          $json_properties['my_complete'] = 2;
    
       } else {
    
          $json_properties['my_complete'] = 3;
    
       }
    
       return $json_properties;
    
    }
    
    add_filter( 'geo_mashup_locations_json_object','my_geo_mashup_locations_json_filter', 10, 2 );

    The custom.js (based on the plugin authors wiki) that I have into the Custom Plugin is this:

    GeoMashup.addAction( 'objectIcon', function( properties, object ) {
    
       // Use a special icon in case the custom 'complete' var is set to 1
    
       if ( object.my_complete == 1 ) {
    
          object.icon.image = properties.template_url_path + '/member-icons/icon1.png';
    
       } else if ( object.my_complete == 2 ) {
    
          object.icon.image = properties.template_url_path + '/member-icons/icon2.png';
    
       } else {
    
          object.icon.image = properties.template_url_path + '/member-icons/icon3.png';
    
       }
    
    } );

    The folder member-icons is lying in “../themes/mytheme/member-icons/”.

    I am calling my map like this on a page template:

    <?php $map_args = 'zoom=12&add_overview_control=false&auto_info_open=false&add_map_type_control=false&object_name=user&object_ids=1,2,3,4&locality_name=' . $city;
    
    echo GeoMashup::map( $map_args );?>

    I have no idea and am stuck why it is not working, and I really hope somebody here, might find the answer.

    Any help is appreciated.

    https://www.ads-software.com/plugins/geo-mashup/

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom Marker by User ACF Custom Field’ is closed to new replies.