codersgrave / Facebook-Friend-Selector

This repo is no longer maintained. Feel free to fork and update!
http://facebook-friend-selector.codersgrave.com
64 stars 22 forks source link

include groups as well as friends #1

Closed smatthews1999 closed 11 years ago

smatthews1999 commented 12 years ago

Here is some code that will add groups to the selection list. The app needs to request 'user_group' permission.


_getFacebookFriend = function () {

    $('#fs-user-list').append('<div id="fs-loading"></div>');

    // start of group changes

    //FB.api("/me/groups", function(response){
    FB.api('/', 'POST', {
        batch: [
            { method: 'GET', relative_url: 'me/friends' },
            { method: 'GET', relative_url: 'me/groups' },
        ]
    }, function (response) {

        if (response.error) {
            alert(fsOptions.lang.fbConnectError);
            _close();
            return false;
        }          

        //var facebook_friends = response.data;
        var facebook_friends = JSON.parse(response[0].body).data;
        $.merge(facebook_friends, JSON.parse(response[1].body).data);
        // end of group changes

I am somewhat of a javascrips beginner, so please improve. .. and I've never forked anything on GitHub.. so not even sure how to go about that.

Sam

sevilyilmaz commented 12 years ago

Hi Sam,

What is the point of adding groups to the list?

Thanks again,

dimfisch commented 11 years ago

I would love that feature too. Adding groups would allow the user to easily select a whole bunch of friends already included in the group without having to go through all of them one by one. Any plan to add that feature soon? Thanks in advance!

otang commented 11 years ago

@smatthews1999 this is great. Thank you!