I have found that there is a way to find which of my friends are the users of my facebook app.
$retrobj=$facebook->api(array('method' => 'fql.query', 'query' =>
"SELECT name FROM user WHERE is_app_user = '1' AND uid IN (SELECT uid2
FROM friend WHERE uid1 = '" . $user. "')"));
The above query will show which of my friends uid use my app.
Then i use a while loop to parse through the returned array.
My question is the following...
If i do not have their id's, is there a way to get all the users even if they are not my friends that use my app?
I haven't found a way that is why i am asking if there is actually a way to do that.
Any help appreciated.
Thanks
No. Facebook found that some developers were building apps just to harvest Facebook usernames, and spam them. They removed the ability to return a list of app and page users.
Any FQL query you run must have one of the indexed fields (marked with a star) in your WHERE clause, or the query will fail. That requires a name, username or user_id. Querying the friend, event_member, stream or checkin tables are a few of the valid ways to get a list of other users.
Related
i use app with v2.3 api, and i wanna to search a friend by name.
Fql was deprecated and with graph i don't know how.
$params = array('method' => 'fql.query','query' => "SELECT uid,name,pic_square from user where uid IN(select uid2 FROM friend WHERE uid1=me() AND strpos(lower(name),'".$search."') order by name limit 5");
You can use the Search API in v2.x:
graph.facebook.com/search?q=yourfriendname&type=user
Another way is to use /me/friends and go throug the results to find the friend by name. Keep in mind that you can only get those friends who authorized your App too though.
Sorry, but this method return just irelevant results, not my friend who searched in facebook bar, not enough closer.
Sorry for my eng.
Is there any way using the graph api to search all users but to list matching friends first?
If I search using this it requires a user access_token. So it knows who I am. So why does it (almost seem like its) avoiding displaying my friends? Why doesn't it return my friends that match the query first and then after that, anyone else?
Is there a way to make it mimic that functionality?
I also wondered the same thing as the OP. The only thing I've been able to come up with in my research is using FQL...The problem with FQL? After v 2.0 of the Facebook API it will no longer be available--and the version after that it will probably be deprecated.
But in the interest of getting a working solution NOW, I found this SO (third answer down): searching friends using facebook graph api
Here's the example that worked for me:
select uid, name, sex
from user
where uid in (SELECT uid2 FROM friend WHERE uid1 = me())
and (strpos(lower(name),'Jack')>=0 OR strpos(name,'Jack')>=0)
Also, if you want their pic use:
select uid, name, sex, pic_small
from user
where uid in (SELECT uid2 FROM friend WHERE uid1 = me())
and (strpos(lower(name),'Jack')>=0 OR strpos(name,'Jack')>=0)
(I'm getting their small pic but documentation for other sizes of the pic is found here: https://developers.facebook.com/docs/reference/fql/user/)
If I create a page, is it possible to get a list of all the people that like that page on facebook. For example, if I create http://www.facebook.com/honeybadger, as an admin can I get a list of everyone that likes it?
You can't get a list of users who like a URL or Facebook page anymore. Facebook has gone and taken the page_fan and url_like tables and made the only indexable column on these the uid field.
Trying something like this
SELECT uid FROM page_fan WHERE page_id IN (SELECT page_id FROM page WHERE username = "honeybadger")
Throws an OAuth exception: "Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http://developers.facebook.com/docs/reference/fql"
The only thing you can do is create an app, have users authorize your app, then test if an authenticated user likes a specific page or link. If you ask for the right permissions, you can also test to see if their friends like your app.
This change was implemented to prevent spammers from harvesting Facebook IDs from their page fans or url likers.
The Facebook documentation seems to give the exact answer to your question.
https://developers.facebook.com/docs/reference/fql/like/
SELECT user_id FROM like WHERE object_id = <INSERT_FACEBOOK_OBJECT_ID_HERE>
simpler way is to get it thru graph api
https://graph.facebook.com/honeybadger/likes?access_token=valid_access_token
I'm trying to get the pages that my friends like using this FQL multiquery:
{
"query1": "SELECT uid2 FROM friend WHERE uid1 = me()",
"query2": "SELECT uid, page_id, type FROM page_fan WHERE uid IN (SELECT uid2 FROM #query1)",
"query3": "SELECT page_id, name, categories, type, page_url, pic_big FROM page WHERE page_id IN (SELECT page_id FROM #query2)"
}
The query works fine and returns results. However, it returns around 2940 pages for 260 people, which is way less than the sum of the actual like count for the people queried.
I considered it could be a permission problem and asked for one of the people on this list to remove "access likes, interests..." permissions for friends' applications. On the next run, her pages and likes weren't on the JSON returned, but the page count actually increased some 10 or 20 records.
Am I doing something wrong here? I'm using multiquery for performance reasons.
This occurs both using the Graph API explorer and the PHP SDK:
$fql = urlencode($fqlQuery);
$response = $facebook->api("/fql?q={$fql}");
Any thoughts on this problem?
Thanks in advance :)
There is an additional privacy feature on Facebook that might be limiting the results you receive from certain people.
The setting is in the privacy settings and its called - How people bring your info to apps they use
It also gives a short description -
People who can see your info can bring it with them when they use apps. Use this setting to control the categories of information people can bring with them.
One of the options within that settings is "Activities, interests, things I like". For my profile this option is set to off. So no matter what permissions an application gets from a friend of mine, that application will not be able to see my "Likes".
My suspicion is that some of your (wiser) users have this setting disabled as I do, and it is preventing your application from getting to that information.
As an aside, I think this setting is crucial for real privacy on a Social Network. Just because my friends can see what pages I like, doesn't mean I want any application they use to also be able to see that info.
Am working on a facebook application and i will like to display to the user his/her friends that are already users of the application.
I have been able to get the facebook user ids of the users. Now am trying to find out if there is a facebook api resource i can use to render the user's pictures and names by just passing the ids to it.
thanks in advance.
You should try out with FQL and the user table.
http://developers.facebook.com/docs/reference/fql/user/
There you have a is_app_user field, which can be queried. The table is indexed by uid, which means you can use ids of friends to check.
With fql like this you should be able to read all friend ids who are using your app, assuming $user is current user id:
SELECT uid FROM user WHERE is_app_user = 1 AND uid IN (SELECT uid2 FROM friend WHERE uid1 = $user)
Please check out this post: Can the full name and profile picture of a user signed in via Facebook API be displayed publicly?
Good luck! :)
As others have mentioned, you can use FQL to get the information you need. But if you just want to use the user ID, you can use FBML and have the Facebook javascript lib render the FBML on the client side. You would want to use fb:name and fb:profile-pic then.
You could also use fb:multi-friend-selector if that is what you are looking for.
Have a look at this documentation page http://developers.facebook.com/docs/reference/fbml/#user/groups.
Use the fb:name tag for the name and fb:profile-pic for the profile picture.
Just loop through all the IDs and display the those two tags for each of them.
I think that what you are looking for it's the Facebook facepile, it's a social plugin.
Just give the app_id and it shows the faces of your friends using it.