Profile stats and location in profile page like buddypress.org
Maybe this will help. But I don’t use this plugin so I’m not sure if it includes the widget used on this site.
The map on the profile pages on this site are hardcoded with the following: http://pastebin.com/rqd16Rm9
isn’t it allowed to just take necessary piece of code from gPress?
Are you asking for permission?
You can hack anything you like, preferable is to write it yourself where possible. Paul provides you with the code you need above though so it might be better to use that but perhaps update it to use V3 map api.
couldn’t you specify, where exactly I should put this code?
(probably, profile-loop, but somehow it does not work for me).
V3 map api would be good, but my knowledge of html, php, etc..won’t allow me to do this.
P.S. “..Are you asking for permission?..” I just don’t know what all these plugins licenses mean. maybe authors of gPress will decide to eat my tiny www for this x lines of code
It’s gpl code, Apart from the fact that no would know, give due attribution to the original authors of the work/ code snippet and unlikely anyone will eat your www
The code above that Paul shows in the pastebin example is run as a standalone snippet that you would place where you wanted the map to display or you could run it from a functions.php file using add_action function to place the code on the page where there is an action hook such as bp_profile_header_meta.
To see the code working try placing it somewhere in the members-header.php file perhaps for testing purposes before or after the div item-meta block of code. As for where it really needs to go for your requirements that’s harder to say
sorry guys, code works well, however Google Map API V3 would be good update.
Are you referring to API key? in which case you must obtain one first and replace the one in the example code.
don’t know why, but first API that I got did not work, so I had to get another one, which works well now.
Just a heads up for anyone else (i.e. – n00bs like me) who wants to implement this on their site: when you insert your new API key in the code where it says [YOUR API KEY] , make sure those square brackets – [ ] – are removed. In other words, don’t just drop your key between them (like I did ) ‘cuz it ain’t gonna work.
A little styling and it works & looks just fine. Check it out:
V3 API removes the need for a key, If people ask nicely I may post my revised map code
When I get the chance I’ll try and wrap it as a plugin – in the meantime there was a plugin being written by travel_junkie that may suit, not sure how far that’s come in development.
Goody! I’d like to incorporate this into my new theme framework (coming along nicely…). That is, if you don’t mind credit and some link love
I couldn’t figure out how to do it without the key but, now it looks doable. Thanks a bunch!
bp-user- maps is the plugin I was looking for and works very fine. Thanks @hnla
I tried the plugin, although it does not show up in the profile?
Must be because I am using custom theme
@pcwriter go for it, it’s there to be used if it suits the purpose. – API keys were always a pain
@leguis08 Glad it works.
@gunju2221 It is very possibly a custom theme issue, a custom theme will have to have ensured that the correct action hooks exist in pages as the main maps are fed through to the page via these, you could test with the widget instead which was provided really so that site admins could place the map in more refined custom widitised areas of the members profile pages if they existed.
When writing something like this you can only account for that which is known thus the included stylesheet is there simply to try and style the map if it’s dropped into bp-default, therefore those styles may not have relevance to a custom theme, especially where that theme may be heavily modified, however the basic styles are worked on elements and element id’s/classes that should exist in any theme.
The other aspect of course is that you must have created that extended profile field and named it ‘location’ and existing users will then need to actually edit their profile to add an address or partial address for the map to display, if a user hasn’t filled this item in then the map does not display at all.
You must be logged in to reply to this topic.