Posted by suffering drupal on April 4, 2009 at 11:23am
Hello all.
Is it possible just to add a map to a user page?
Even after 2 years of struggling, I still feel like a newbie, as I say in all my posts, and I have been trying for myself for some weeks now (few spare hours a week) and I am about to give up on this AND on Drupal.
How come it is not possible to find a step by step explanation or even any reference to something essential and apparently simple like this?
For the moment I have the impression that users dispose of a map only for INPUT but NOT for OUTPUT????
User locations (map/user) is ok, but where to go to make a clone that filters out per user? It's not a view...
AND.... how to include a block in a User Page??
Please help.
Riccardo.
Comments
Try this views recipe
Hi Riccardo,
You can make a GMap appear on a user page using Views, Location and GMap modules. Here are some instructions to get started. The attatched screenshot shows how it will look. I hope this is what you need!
Enabled modules
Location and GMap settings
admin/user/settings
:-)Views Settings
See attached settings diagram; also views-export code which you can import.
Block Settings
I placed the User Map block in the footer region of the Garland theme. (You could put it in any region; Content Bottom would be a better choice if your theme provides it.)
Important: You need to configure the User Map block, and set the Page Specific Visibility: only on listed pages to
user/*
. This ensures it only appears on the user page.To summarize: you have enabled user locations, and created a block view which takes a user ID as an argument (therefore only shows one user). The block is configured to appear only on user pages, and does not show if the user has no location.
That should get you on your way - tweak the settings to suit yourself. Be sure to let us know how you get on, and Good luck!
Thanks!! But no luck
Hi Andrew,
Thanks for your detailed reply :-) and sorry for the late reaction :(
I have posted so many issues and have so many more in my head that I have lost track!
I already had something like you're describing, but anyway I've followed your instructions by the letter to try anew. No luck though :(
My Drupal configuration is as you suggest (or higher) and I checked both with the Marinelli theme I use as Garland.
I don't understand... do you think some other module like content-profile may be overwriting something in the configuration?
In fact strangely enough through the Content Profile module I AM ABLE to reproduce a map at the bottom of the user page, but it requires some confusing twists, let's see if I can explain:
Under content-profile you can add node-like content to a user and define fields for it.
It has a mandatory title field which then turns into a kind of alias for this 'user content-profile-node'.
1) If you now go to the 'normal' user page, the stuff from Content Profile is embedded there. You see the 'normal' user information (fields) plus the additional Content Profile info/fields. No map though.
2) However, if you go to the alias of the Content Profile, you only see CP info/fields (not the user avatar, because that's 'normal' user info) AND the block with the author-map!!!
This block was previously defined to appear under the user contents/footer of course.
When you give this Content Profile a title that is the same as the username, then when you go to the user, you see 2) - in other words, it overwrites the alias of the user.
This could lead to the option of putting all the user fields in Content Profile and just leave image/avatar and map to the 'normal' user fields. But then each user should know that they'd have to use their username as title for the Content Profile, a bit tricky. AND you loose the image on the userpage itself.
Anyway, I'd prefer to see your method work... so I'll keep on investigating.
If you have any clues on why it doesn't work on my site I will be happy to know.
Cheers!
Riccardo.
Same problem - any solution?
Hi Riccardo,
I have the same problem also using content profile module. Did you ever get a solution to this?
Thanks,
Andy
Worked for me!
Thanks so much! I just spent the past 4-5 hours looking for this!
Works great with my set up.
I'm using the core profile module and everything else up to date as of today (fresh install to test this).
Just to be thorough: everything else = gmap, location, and views.
Problem with Views Arguments in Block Regions
The first time, I skipped the part about the views argument on accident -- I just realized that the block works without that argument, but doesn't work with it. (Block View used as a block.)
I've heard of this before...
You can't use a Block View within a block region (I read that here). Or, I guess, there are issues with Views Arguments when you try to. This page may also be helpful on that subject.
Creating a page, or using the Block View NOT in a block region works.
Hope this is helpful!
Aaack! Problem with Views Arguments in Block Regions
OK, so I did it as you mentioned, I set up a page view and went created a user-profile.tpl.php file for my user and then added a link there and a snippet of script to scrape the user uid from the url or alternately from $user. I stuck this variable in my link which I had set up in the view as mysite.com/user/%/map and also made a gmap-view-gmap.tpl.php theme file to display the map.
So, I opened up my page and it worked. Great! Except that the map used a goofy little marker with a little Drupal drop in the marker. So, I went into gMap settings and changed to another marker for the "page" display. Next the display goes away.... I revisited views and dumped my cache and all that and the views says "this display has no path" although the path is there plain as day. Ideas?
Block view could still be used as a block
Thanks for posting this page, it came in quite handy!
Concerning the Block View, I used "Provide default argument" instead of "Hide view / Page not found (404)" as an action if the argument is not present and a default argument type of User ID from URL and that seems to display the map of the user's location as a block.
Hope this helps,
Ok i did this and there is a map for sure...
but it shows all the fricken nodes that the user has posted.. not the profile location. STARTING TO P me off. how do i narrow views to only show the profile location?