Retrieve Facebook Fan Names - ajax

I'm trying to grab the names of fans of a Facebook fan page that I administer. I've done some snooping around, and apparently, the FB API doesn't support that, but Facebook actually uses AJAX/JSON to populate the list. Anyways, can anyone suggest a way to make that call myself and grab the data as plain text?
Also, I've found a hack that a guy wrote in Ruby, but I am completely unfamiliar with the language.
Thanks for the help in advance!

At the current time the FQL schema would suggest that there is no way to get a collection of FANS for any given PAGE. I think they are hiding this information because they display the FANS on the page... One would think that at least the ADMIN would have privileges to see the list of users.
Anyway... I hope someone make is possible in the near future.

can you please try this and let me know :
select uid,name from user where uid in ( select uid from page_fan where uid in (select uid2 from friend where uid1 = me()) and page_id = 'Your Page Id')
I think you can get it only for the currently logged in user and his / her friends only.

If you have less than 500 fans, you can use the following url:
http://www.facebook.com/browse/?type=page_fans&page_id=13207908137&start=400
Each page will give you 100 fans. Change &start to (0, 100, 200, 300, 400) to get the first 500. If &start is >= 401, the page will be blank :(

I found that in the doc: http://developers.facebook.com/docs/reference/fql/page_fan/
uid - "The user ID who has liked the Page being queried."

SELECT first_name, last_name FROM user WHERE uid IN (SELECT uid FROM page_fan WHERE page_id = [your page id])
This should work, but I get an error trying to run this through the .net facebook api...something about the where clause not being on an indexable column, which it is.
Perhaps give that a try on your platform.

That one worked
SELECT user_id FROM like WHERE object_id="YOUR PAGE ID"

Related

what is wrong with my query, it is not being saved?

I am migrating an app from old apex to the new version. some of my pages are not saving the new changes that I am making. for example this is my query for a page item from the old apex environment:
select DESCRIPTION display_value, DESCRIPTION return_value
from AUC_AUCTION_TB
where admin_emailaddress =
(select email
from SYSTEM_USERNAME_TB
where username = :APP_USER) or :APP_USER in ('SESH','PETS','ROPO','JEMU','HESH')
order by START_DATE desc
So I want to make some changes to the query in the new environment, because the new environment is using a different table. My new query is:
select DESCRIPTION display_value, DESCRIPTION return_value
from AUC_AUCTION_TB
where admin_emailaddress =
(select EMAIL
from ALL_USERS
where USERNAME = :APP_USER) or
:APP_USER in ('SESH','tshithigonap','poolmar','muhulumaj','shipaleh')
order by START_DATE desc
The problem is when I make this changes the page is not being saved with the new changes, I keep getting this pop up:
There are unsaved changes. Press Ok to discard your changes or Cancel to return to the current page.
So when I go to a different page and then come back to my page, I notice non of my changes have been saved, even though I clicked the save button. Is something wrong with my query perhaps or why is this happening, I have many pages with this issue, please help.
It doesn't have to be that query (it looks OK); there's something else that is wrong on that page. What? Check errors, here:
That's a dummy error I just produced, just to illustrate the issue; you'll get some other message. Then click on each of those messages - Apex will take you to that very spot.
If the query in your example gets executed correctly in a separate worksheet, there's probably an issue in passing the bind variables or setting the correct type of region.
Maybe try using v('APP_USER') instead of :APP_USER.
So my changes were not being saved because I did not have permission, so one of the admins in the app changed my permission from Developer to administrator, so I logged out and logged in again with administrative rights. So this allowed me to change changes for a while and later I experienced the same problem again, but this time all I had to do was change the browser from chrome to Firefox, now everything is working perfectly, thanks a lot!

webmatrix user id stored as -1 sometimes

I am developing a website using Webmatrix. I have a post page where user can post an item with several fields like item name, description, user name, phone number etc. I take all these values and save the item in database. Alongwith all this data provided by the user, I also save a user id of the user with WebSecurity.CurrentUserId method for that item.
This works well almost everytime. However, on very few occasions, I noticed that user id is stored as "-1" for some items.
I am absolutely clueless and can't figure out why it's happening.
Has someone ever experienced such thing. Or can someone may have clue about this?
I am not certain this will solve your problem but it would not hurt to verify that the current user is also defined within your web security database with WebSecurity.HasUserId property. I would give that a try - let me know what happens.
Hope that does the trick!

Comet chat integration with Code Igniter

I am using comet chat with Code Igniter 2.0.
Problem-
i have a listing page where all the users are listed and i need to show their comet chat status ("Online" or "Offline") next to their name.
For this purpose we have a DB field ('chat_status') in our users table, we usually set this field to '0' or '1' when user logged in we set this field to '1' and when user logged out we set this field to '0'. I just want to use comet chat call backs that will return all the online user_ids in array so i will change their 'chat_status' to '1' in our users table.
I couldn't find any comet chat function or query that will return all the online users in one shot.
Can you please assist me to solve this stuff.
Thanks in advance
There is a function in integration file [in my case its in its integration.php]
function getFriendsList() show all the friends on-line but if you want to show all the user insted of friends fellow the instruction given in link
You just have to edit the 3 sql queries in integration.php function by making changes to the username field .
You can write a subquery and get the status of the user that will be very easy .

Getting events that a certain profile is attending

Im trying t get some info for some events that certain profile rsvp status is attending but it retrieves blank. Maybe is something about access tolken or whatever.
This is my current fql
SELECT name, pic, start_time, end_time, location, description
FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid = 100003454558689 AND rsvp_status = 'attending')
ORDER BY start_time asc
But it retrieves blank. How can I fix it?
Well your code is good, you just have to make sure you have the user's rights to get that data. So go to the facebook graph explorer, and pop in your code, but this time change the UID to me(). Why does that work?
Your access token, granted by the Facebook app, determines what user data you can see on Facebook. The Graph Explorer by default shows you your own data.
So make sure that you have the right permissions for event data. You can test it by the Acess Token drop down on the Graph explorer.
Here is a list of permissions: https://developers.facebook.com/docs/authentication/permissions/
Looks like you need "user_events"
So it might be nothing wrong with FQL, but something in the auth process. Good luck.

Facebook API get events CREATED BY friends

I am developing facebook app which needs to retrieve events created by some of my friends.
Standard SQL query would look like this:
NSString *fql1 = #"SELECT "
#"eid, name, tagline, id, pic_small,host, description, start_time, creator "
#"FROM "
#"event "
#"WHERE "
#"creator = 1111111111 OR creator = 2222222222 OR creator = 333333333";
Facebook allows only to filter tables by indexed fields (which is eid in this table). I assume I could to construct multiquery. Anyone could help with it? I spent some time googling it with no look. I need only one query so learning whole fbl for this has no sense for me at the moment.
BTW: there is a function events.get - you can filter by uid (documentation says):
parameter: uid - Filters by events associated with a
user with this uid.
ASSOCIATED In what sense? are those creator's uids?, invited, attending or maybe? Why facebook documentation is so frustrating?
When I try events.get with uid parameter it returns result with different creators ids than uid parameter.
Graph API function: uid/events returns events user has been invited to, attended or other status but NOT necessarily created by him.
What am I missing here? I granted necessary permissions to my application, it connects, gets friend's event lists but not the events I want.
Seems so simple but I con not find straight-forward solution.
I'd appreciate any help.
You can do something like this:
SELECT
eid, name, tagline, pic_small,host, description, start_time, creator
FROM
event
WHERE
eid IN (
SELECT
eid
FROM
event_member
WHERE
uid=111 OR uid=222) AND
(creator=111 OR creator=222)
Basically this says get the events user 111 or 222 is a member of and of those, only return the ones they've created. Because eid is an indexable field, FQL is okay with this, and is happy to do the additional (creator=111) trimming for you.

Resources