Check this out : BuddyPress check-ins !

Publié le

par

Un plugin BuddyPress pour expérimenter la HTML5 geolocation API.. On se croirait presque dans foursquare !

BP check-ins ?

Il s’agit d’ajouter la possibilité de localiser ses actualités de profil (profile updates) ou les actualités que l’on publie dans un groupe (group updates). Pour ce faire, depuis la textarea « what’s new » de la homepage des activités, d’un groupe ou se son profil, il suffit cliquer sur l’icône en forme de marker qui s’est glissé dans son coin supérieur droit.

Merci à la HTML5 geolocation API 🙂

Une fois le marker cliqué, votre navigateur vous demande l’autorisation de diffuser votre position géographique, si vous acceptez, le Geocoder de google map nous fait un reverse geocoding pour afficher une estimation d’adresse. Si vous refusez ou que le navigateur contient le mot explorer dans son nom, pas de souci, vous pourrez vous même rechercher votre adresse depuis un champ texte. Dans les deux cas, si le résultat ne vous convient pas vous pourrez affiner en utilisant le bouton de modification de l’adresse. Il ne vous restera plus qu’à entrer le texte de votre activité avant de la publier

checked-in !

Une fois l’annonce publiée, un lien se glisse juste au dessus du bouton « commenter ». En cliquant dessus, vous atteignez le permalien de votre activité enrichie d’une carte vous positionnant à l’endroit où vous vous êtes géolocalisé.

J’étais là quand j’ai fait cette màj!

Pour finir, si vous allez sur l’onglet « friends » de votre profil, une carte s’est glissée au dessus de votre liste d’amis et si toutefois ils ont eux aussi fait un check-in, vous verrez leur dernière position connue.

Carto de mes pôtes.

Démo animée..

Config nécessaire pour tester cette expérimentation : WordPress 3.3.1 / BuddyPress 1.5.5. Attention ce plugin est en ‘beta – work in progress – dontUse on Prod’.

Merci de vos éventuels commentaires 😉

99 réponses à “Check this out : BuddyPress check-ins !”

  1. Avatar de wrkazi
    wrkazi

    @imath

    I get this error on chrome and firefox both when the home page loads.

    Floatbox does not support quirks mode.
    Page needs to have a valid doctype declaration.

    Is floatbox used in bp checkin? I guess there is some kind of clash with the Floatbox installed on wordpress.

    Thanks

  2. Avatar de Miguel

    @wrkazi IE9 last version not working for me, just a message « no address » when type an address, works. No other GEO plugin activated.
    Why in your IE9 works? Maybe @imath could send a clue about.

  3. Avatar de wrkazi
    wrkazi

    @Miguel

    There is no need to type the address

    Do you get a browser prompt asking to to share location?

    Also use the default bp theme

    @imath

    An email notification of new activity with the map url to friends would really be useful. Bp doesn’t send activity alerts to friends. Possible to add in next update

  4. Avatar de wrkazi
    wrkazi

    Hi @imath

    have a following suggestion:

    BP checkin privacy settings for users. Show location precisely or show location on a city level.

    In short allow the user to choose what he wants to show. Either shows the greater surround area (i.e. city) vs. the exact location within the city.

    Whats is your opinion? Is this useful?

    Thanks for your time

  5. Avatar de imath

    hi @ wrkazi

    Thanks for your suggestions. I’ll see what i can do.

  6. Avatar de wrkazi
    wrkazi

    Thanks a lot for your reply @imath…looking forward to the new version of BP Checkin…Thanks once again

  7. Avatar de Dan

    Thank you very much for developing this plugin! Your work is greatly appreciated!

    1. Avatar de imath

      Hi Dan, thks 4 your comment 🙂

  8. Avatar de charles clarke
    charles clarke

    Hey there,

    Great plugin! I keep getting this when I click on the icon

    OOps, we could not localized you, you can search for your address in the field that received the focus.

    Is there anyway I can fix that? What plugin do I need for it to localized the search?

    Thanks for your time!

    1. Avatar de imath

      Hi Charles,

      The plugin is using the HTML5 geolocation API, you need to use a browser that can handle it (i’ve tested with latest version of chrome, safari and firefox). You also need to authorize the website to access your geo data, in these 3 browsers a message prompt for your authorization.
      Thanks for your comment.

  9. Avatar de valuser
    valuser

    Apology for lack of French.
    Works great in single installation.
    Testing now in a local multi-network/multisite.
    In this scenario No link to wp-admin/options-general.php?page=bp-checkins appears
    Your reply to Fareed of Avril 17 suggests to activate the plugin in wp-admin rather than wp-admin/network. What happens then is that the plugin is activated at wp-admin/network anyway but no settings page appears anywhere.
    Trying to access the settings page via wp-admin/options-general.php?page=bp-checkins results in You do not have sufficient permissions to access this page.
    On the Front end activity checkins appears and accepts and shows a map. However that map while it is recorded cannot subsequently be reopened.
    Understand that this is the holiday period so no rush on a reply expected.

    1. Avatar de imath

      Hello Valuser,

      Actually, i’ve submitted a ticket to WordPress Core tracker as the tag Network in plugin header is not working in wp 3.4.1, It will be fixed in 3.4.2 i think : bp checkins, like BuddyPress is a network only plugin and should only be activated in network admin. Now in BP 1.6, the admin link should be in the network settings menu. I’ll look at the issue you submitted to figure out where the problem is.

      Thanks for this feedback and all the previous ones, i appreciate them a lot.

  10. Avatar de imath

    @ Valuser,

    Concerning BP Checkins 1.0 (beta in trunk)

    I’ve just checked out on my multisite configs by downloading the trunk version and replacing the plugin files : if BuddyPress < 1.6, the admin page is localized in BuddyPress network admin menu :

    /wp-admin/network/admin.php?page=bp-general-settings

    else (BP 1.6+), it’s located in the settings network admin menu :

    /wp-admin/network/settings.php

    i can’t remember what i’ve said to Fareed, but if i’ve said to activate bp checkins in blog admin on a multisite config, i must have been very tired. BP Checkins is a network plugin, so it must be activated in the network admin.

  11. Avatar de valuser
    valuser

    Point taken and thank you.

    Will the only change be as outlined on the WP trac in Ticket #21187: 21187.2.diff ?

    Out of curiosity (as i have no coding knowledge) I tried the following:-

    set-up wp 3.4.1 – bp 1.6 – bp-checkins 1.0 (beta)

    single site all well maps can be easily retrieved when a checkin is clicked–see below

    On a test local multisite multi-network (bp-multi-network) in wp-admin/includes/class-wp-plugins-list-table.php (i know it is not recommended to tinker with core files…….)

    Immediately after // Filter into individual sections

    I replaced

    if ( ! $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) {
    with
    if ( is_multisite() && ! $screen->is_network && is_network_only_plugin( $plugin_file ) ) {

    Now bp checkins settings appears in each network — great

    But….. still can’t retrieve maps

    clicking on http://sitea.mydomain.dev/activity/p/409/?map=1 goes to http://sitea.mydomain.dev/members/admin/activity/409/?map=1 but no map appears.

    Obviously I may very well be jumping the gun here as I have no real understanding of what I am doing.

    It is not urgent, but the plugin is so great I want it to work!. So I thought I’d let you know.

    1. Avatar de imath

      Thanks @ Valuser, i’ll look at it real soon.

    2. Avatar de imath

      Hello Valuser,

      Just ran some new tests :
      – Downloaded a fresh version of WP 3.4.1
      – Downloaded a fresh version of BP 1.6
      – Downloaded the latest BP Checkins from trunk
      – Installed WP then, added the multisite config
      – Installed BP
      – Installed BP Checkins

      I’ve tried different scenarios (enabling/disabling activity checkins, enabling/disabling the checkin/places component), and i always have the map displayed when on a single activity with the extra request var ?map=1 as you can see on this image from my photobucket account : http://i917.photobucket.com/albums/ad19/im4th/Image1-4.png

      What are the other plugin you use ?
      The google map is a javascript script, in your header you should have these lines :

      <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&ver=3.4.1"></script>
      <script src="http://maps.gstatic.com/intl/fr_fr/mapfiles/api-3/9/13/main.js" type="text/javascript"></script>
      <script type="text/javascript" src="http://sitea.mydomain.dev/wp-includes/js/jquery/jquery.js?ver=1.7.2"></script>
      <script type="text/javascript" src="http://sitea.mydomain.dev/wp-content/plugins/bp-checkins/js/gmap3.min.js?ver=3.4.1"></script>

      Hope it will help you fix the trouble, please tell me about it 😉

  12. Avatar de valuser
    valuser

    Many thanks.

    A list of plugins in use is at http://pastebin.com/hp2742SW. (i am probably pushing it a bit.)

    Anyway on one network I will restart with just buddypress and bp-checkins and take it from there.

    Will let you know how I get on – probably at the end of next week!

    If its just a multi-network issue I should know sooner.

  13. Avatar de valuser
    valuser

    its a plugin. Apology for troubling you when i should have tested for incompatibility first.

    I’ll find it and let you know. Cheers & thanks

  14. Avatar de valuser
    valuser

    EARLY indications are that (at least in a multi-network setup) the plugin Events Manager (http://wordpress.org/extend/plugins/events-manager/) does not allow BP-Checkins to work properly.

    Both BP-Checkins and Events Manager are MAJOR buddypress plugins so what to do now ??

    I will go through the other plugins but the story above is most likely the cause.

    I have only tested this in a multi-network, bp-multi-network set-up.

    1. Avatar de imath

      Thanks Valuser for your investigations. I think event manager plays with google map, it may be the reason. I’ll look if i can from BP checkins make the 2 go along.

    2. Avatar de imath

      Well, i’ve installed Events manager. I haven’t noticed any conflict on my multisite config. It seems to work… The only thing i noticed is that this plugin loads many javascripts on every page of the blog (jquery ui, events-manager.js) even if many parts dont need it… Hopefully, the javascripts for map are only loaded when this plugin needs it (locations)

  15. Avatar de valuser
    valuser

    This is embarrassing. It seems your time has been wasted by an imbecile! Deactivated all network plugins except bp-checkins and Event Manager and, like you said, they dance together. I’ll just keep on checking and will report what I find. and thanks.

  16. Avatar de valuser
    valuser

    ok

    i really pray that this is not also a false alarm !

    buddypress +bp-checkins+bp-gtm-system ok
    buddypress +bp-checkins+events-manager ok
    buddypress +bp-checkins+events-manager +bp-gtm-system not ok

    1. Avatar de imath

      Hello Valuser,
      Thanks for your tests 😉 I’ll check this config to see if i can do something.

  17. Avatar de imath

    Hello @ Valuser,

    Actually the trouble is between Events Manager and BP GTM System. The reason why is that these 2 plugins are loading their javascripts on each page of the website instead of only load the javascripts when their plugin really needs it. I usually try when building my plugin to only load the script when i really need : for instance if BP Checkins is activated, you won’t find its javascript when loading a blog post or a blog page… With this 2 plugins activated the scripts they need are loaded everywhere on front.. So i guess the best for you is to contact the plugins authors to warn them there’s a javascript conflict between their 2 plugins.

    In the meantime, i simply added these lines to the functions.php of my active theme and it seems to fix the problem :

    function imath_avoid_conflict_error_gtm_events_manager(){
      /*
      If map is required and gtm is hooking wp_print_scripts then, i remove this hook.
      Anyway, BP GTM doesnt seem to deal with activity single template...
      */
      if( isset( $_GET['map'] ) && has_action( 'wp_print_scripts', 'bp_gtm_js_groups_all' ) ) {
        remove_action('wp_print_scripts', 'bp_gtm_js_groups_all');
      }
    }

    add_action('bp_actions', 'imath_avoid_conflict_error_gtm_events_manager');

    Thanks again for your feedback, i hope the trick will solve your trouble. I cannot deal with it directly from my BP Checkins plugin as it would be impossible to test all potential BuddyPress plugins conflict. Sorry & hope you’ll understand my point of view here 🙁

  18. Avatar de valuser
    valuser

    To confirm your function solves the issue.

    Many thanks for such wonderful support.

    Fully understand that of course the myriad plugin permutations precludes testing for every scenario.

    Thanks again

  19. Avatar de wrkazi
    wrkazi

    Hi Imath

    thanks for the update. As soon as i upgrade to 1.0 version and try to go to the second settings tab of checkin/places the site goes down. I get the following error on chrome

    HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

    I tried this with BP 1.5.6, 1.5.7 and 1.6. I also reset my WP db with the same results.

    Any way to debug this?

    Kindly let me know

    Thanks

    1. Avatar de imath

      Ok @ wrkazi,

      what says your error.log ?

  20. Avatar de wrkazi
    wrkazi

    Hi @imath

    thanks for your reply. Following errors noticed with BP 1.6.1

    When i activated the plugin i got this:

    Notice: Undefined index: checkins in /opt/www/website.com/wp-content/plugins/bp-checkins/includes/bp-checkins-admin.php on line 71

    Notice: Undefined index: checkins in /opt/www/website.com/wp-content/plugins/bp-checkins/includes/bp-checkins-admin.php on line 76

    Notice: Undefined index: tab in /opt/www/website.com/wp-content/plugins/bp-checkins/includes/bp-checkins-admin.php on line 129

    Notice: Undefined index: tab in /opt/www/website.com/wp-content/plugins/bp-checkins/includes/bp-checkins-admin.php on line 132

    When i went/clicked to the checkin/places settings tab i get this

    Notice: Undefined index: checkins in /opt/www/website.com/wp-content/plugins/bp-checkins/includes/bp-checkins-admin.php on line 57

    Notice: Undefined index: checkins in /opt/www/website.com/wp-content/plugins/bp-checkins/includes/bp-checkins-admin.php on line 63

    As soon as i saved the default settings of checkin/places tab i get this and the site went down:

    Fatal error: Class ‘BP_Group_Extension’ not found in /opt/www/website.com/wp-content/plugins/bp-checkins/includes/bp-checkins-group-class.php on line 6

  21. Avatar de imath

    Hi @ wrkazi,

    Looks like all of BuddyPress is not loaded, which is really weird as i hook to ‘bp_include’ ?!?

    What is the story of your WordPress config : what was the 1st version you’ve installed (WordPress mu?) ?

    You can try to hook to bp_include later to see if it changes something : at line 23 of /bp-checkins/bp-checkins.php edit :

    add_action('bp_include', 'bp_checkins_init');

    by

    add_action('bp_include', 'bp_checkins_init', 99);

    If nothing changed, then i guess, you should email me your website for testing (files + db without)..

    Very strange.

  22. Avatar de wrkazi
    wrkazi

    Hi Imath

    Thanks for your reply. I think have found the issue. Have emailed you the details. Thanks once again for this wonderful plugin.

    1. Avatar de imath

      thanks! i’ve checked and replied.. I guess i need to do some more testing to fix this issue 😉 I’ll keep you updated real soon.

  23. Avatar de wrkazi
    wrkazi

    Thanks @imath….your hard work and time on BP checkin is highly appreciated….Thanks once again