jquery-facebook-multi-friend-selector icon indicating copy to clipboard operation
jquery-facebook-multi-friend-selector copied to clipboard

Get names as well as ID's?

Open deepfriedmind opened this issue 12 years ago • 2 comments

When running getSelectedIds() you only get the ID's. Is it possible to somehow get the names as well?

deepfriedmind avatar Aug 04 '12 20:08 deepfriedmind

^need a similar solution

daltonpereira avatar Apr 13 '13 03:04 daltonpereira

This was a while ago now but I think I ended up doing something like this:

var selectedFriends = $('#jfmfs-container').data('jfmfs').getSelectedIds(),
    friendsWithIdAndName = [];

for ( var i = 0, len = selectedFriends.length; i < len; i += 1 ) {
    FB.api({
        method: 'fql.query',
        query: 'SELECT uid, first_name, last_name FROM user WHERE uid=' + selectedFriends[i]
    }, function(response) {
        return friendsWithIdAndName.push(response[0]);
    }
}

i.e. querying the FB API for each ID to get a name back and push to a new array. Probably not the best solution but it did the trick for me.

deepfriedmind avatar May 09 '13 21:05 deepfriedmind