• Resolved WP-Tutorial

    (@wptutorial)


    Hi UM Support Team,

    Right now your googlemap application is set to the default map view. But as you may well know, there are other types of views that are as important such as hybrid and satellite.

    Could you kindly tell us how we could change from map view to satellite view?

    Here is your code at/wp-content/plugins/ultimate-member/core/um-filters-fields.php:

    	/***
    
    	***	@outputs a google map
    
    	***/
    
    	add_filter('um_profile_field_filter_hook__googlemap', 'um_profile_field_filter_hook__googlemap', 99, 2);
    
    	function um_profile_field_filter_hook__googlemap( $value, $data ) {
    
    		$value = '<div class="um-googlemap">
    
    					<iframe width="600" height="450" frameborder="0" style="border:0" src="https://maps.google.com/maps?q=' . urlencode( $value ) . '&output=embed"></iframe> 
    
    				</div>';
    
    		return $value;
    
    	}

    Many thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @wptutorial,

    You can try to use t=k parameter e.g.

    <iframe width="600" height="450" frameborder="0" style="border:0" src="https://maps.google.com/maps?t=k&q=' . urlencode( $value ) . '&output=embed"></iframe>

    Regards.

    If you want to edit the iframe-url, e.g. add a parameter as explained, you can use a filter like this in theme functions.php, make sure prio is above 99 to get the output after plugin creates it.

    function ov3rfly_um_profile_field_filter_hook__googlemap( $output, $data ) {
    	// edit existing iframe html
    	$output = str_replace(
    		'?q=',
    		'?t=k&q=',
    		$output
    	);
    	return $output;
    }
    add_filter( 'um_profile_field_filter_hook__googlemap', 'ov3rfly_um_profile_field_filter_hook__googlemap', 100, 2 );	// plugin uses prio 99

    If you want to disable the plugin functionality and create complete new own html-code which can use the $value of googlemap field, you can use a filter like this in theme functions.php, make sure prio is below 99 to be able to remove the plugin filter and its output.

    function ov3rfly_2_um_profile_field_filter_hook__googlemap( $value, $data ) {
    	// do not print old iframe html
    	remove_filter( 'um_profile_field_filter_hook__googlemap', 'um_profile_field_filter_hook__googlemap', 99 );
    
    	// $value has the content of field 'googlemap'
    	
    	// example to get/use other fields, maybe for lat/lng or similar
    	$my_additional_field  = um_user( 'my_additional_field' );
    	
    	// create new maps html
    	$output = '<p>your complete new google maps html for "' . $value . '" with iframe or api ...</p>';
    
    	return $output;
    }
    add_filter( 'um_profile_field_filter_hook__googlemap', 'ov3rfly_2_um_profile_field_filter_hook__googlemap', 98, 2 );	// plugin uses prio 99

    Thanks for the great plugin @ultimatemembersupport – feel free to use these examples in plugin documentation.

    Thread Starter WP-Tutorial

    (@wptutorial)

    Good tips both of you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Changing Google map view?’ is closed to new replies.