Skip to:
Content
Pages
Categories
Search
Top
Bottom

buddypress.org: Location in the profiles


  • Philipp
    Participant

    @philippmuenchen

    How amazing is that. I’m searching for such a long time for a plugin solution which gives the users the abillity to show their location as a google map in the profile. And what do I find here… Great and so simple.
    So the big question is: How di I get something (or exactly) like this into my BP Site? ;) I would love to see that.
    Are you also going to show a map of all your members? Generated by all field, which are filled out?

    Looking forward for an answer!

    Philipp

Viewing 13 replies - 1 through 13 (of 13 total)
  • I would like that too. It seems to me I read the description in a plugin but I’ve looked at so many I can’t remember which one.

    +1


    Donald Gilbert
    Participant

    @dilbert4life

    +5

    Not a plugin actually, but someone could turn it into one. It’s actually quite simple, you just need to include the following code in your theme wherever you want the map to appear. You will need a profile field called “Location”. You will also need a Google Maps API key.

    http://pastebin.com/rqd16Rm9


    Ruth Maude
    Participant

    @dandelionweb

    Isn’t that what this plugin will do? https://buddypress.org/community/groups/bp-member-map/ I have it on my list of plugins to try.


    Philipp
    Participant

    @philippmuenchen

    @apeatling Thanks! That’s great. But I have one more question.
    What do I have to change that I can use two profile-fields for the location. I do have “Country” and “City”. Is it possible, that it uses both fields to generate the Location?

    Thanks a lot for your help and greetings from Jerusalem

    Philipp


    stwc
    Participant

    @stwc

    I’ve never been able to get jjj’s plugin to work.


    Scotm
    Participant

    @scotm

    @apeatling This worked fine for me. Thanks.


    Philipp
    Participant

    @philippmuenchen

    Hi!
    It seems to work great. But I still have problems to integrate it into the profile_loop.php.
    It tried it with a table and without….?! I just want to show it on the right side of the profilefields.
    And is it possible to use it with two cobinated profilefields?

    Thanks a lot for your help and greetings from Jerusalem!

    Philipp

    If you simply want it sitting to the side of the profile field table then one approach that you could take but which requires a little editing of your profile-loop.php file along with functions.php so is best done as child theme files would be this:

    Create a function to wrap that google maps api code in and then add that function to:

    add_action(‘bp_before_profile_loop_content’, ‘user_profile_locationMap’);

    In your profile-loop.php file find the do_action(‘bp_before_profile_loop_content’) around this function wrap a new div with an ID of say ‘profile-content-sidebar’ it’s this new element that you would float to the right.

    As – In my case – the ‘Location’ field is a late addition and for most users it will appear on their edit screens but will remain unused I don’t want the new div rendering to the right or otherwise if empty so a conditional is used to test the ‘Location’ field for data.

    The new div is wrapped in:

    if( bp_get_profile_field_data( ‘field=Location’)):

    both for the opening and closing tags this way if ‘Loction’ is empty then the new div will not render and the do_action will be left to render any actions at the top before the profile data table loop as before, with the ‘Location’ field having data then the div is rendered.

    Lastly some styles are required to create the desired visual rendering so create a ruleset for the new element #profile-content-sidebar which would contain properties: float:right; and width:250px the div that hold the profile table ( div class=”bp-widget base” ) now needs to be margined away from the right edge you could do this using a sibling selector which would be the preferred approach as you can in a sense make use of CSS ability to implement pseudo conditional selectors e.g:

    #profile-content-sidebar + .base {margin-right:260px;}

    This is the preferred approach as this ruleset to margin the table elements parent away is only applied if our new div is rendered if not the table will still stretch 100% as before. Of course this approach doesn’t work in certain older generation browsers so it might be best instead to set a new ID on that table parent element to style on but set that ID with the same conditional query used on the new div element earlier.

    There is a certain flaw to the checking for the field ‘Location’ while it works it suits a very particular circumstance and if that area to the right was required for other actions then this ‘Location; check might prove a hindered and doubtless there is a better approach to be worked up in the long run.

    HJi it keeps asking me for a new API key..any thouhts as to why?


    Nonixnaretz
    Participant

    @nonixnaretz

    @Andy: Is there a chance to get this simple code to include a map within groups?


    4ella
    Participant

    @4ella

    I second this ! I am interested to include the map in the groups , I had the same question here.. https://buddypress.org/community/groups/third-party-components-plugins/forum/topic/any-recommended-groups-map-plugin/
    Brajesh promised to create simple map on my request here (maybe not everybody see it because you need to be a member on his site) :
    http://buddydev.com/forums/topic/groups-google-map-plugin-suggestion

    perfect solution for me within buddypress groups should be this:
    http://gmap3.net/examples/address-lookup.html

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘buddypress.org: Location in the profiles’ is closed to new replies.
Skip to toolbar