Limit friends invitation in Facebook Application + Invited users IDS + disabling invited users - facebook

I'm stuck on these three things. Firstly, I'd like to limit invitation count depending on users action i.e. max invitations to 3 friends. Not all, not 30, just 3. I set max attribute, but it doesn't work. I'm using FBML: .
My second problem is that I can't get IDS of users, which has been invited by currently user. I'd like to save to database those invited IDs to use for later.
And most strange, third problem, is it possible to disable already invited users within multi-friend-selector dialog, that they can't be invited many times?
I found solution for 3rd problem: exclude_ids.
I also found solution (damn mistake) with first - limit (max="3" attribute on multi-friend-selector) problem.
At least how can I get submitted/posted/selected IDs of invited users?

Using the JS SDK you can use the max_recipients. I don't know why they do not have documented that.
Here is a sample
FB.ui(
{
method: 'apprequests',
message: 'My Great Request',
max_recipients:1
}
,
requestCallback
)

Worked on that few months ago, trying to remember...:D
Using the JS SDK, you can set a callback function to the invitation dialog.
https://developers.facebook.com/docs/reference/dialogs/requests/
In this callback, Facebook gives you the ID of the invitation requests that have been sent : You have to parse it to get the informations you need (ID of invited people, in your case).
I'm not using only FBML tags, but it seems that using your fb:multi-friend-selector in a fb:request-form allow you to retrieve the IDs of invited people when posting the form.
http://developers.facebook.com/docs/reference/fbml/request-form/
About your filtering problem, in the JS SDK, again with the FB.ui function, there's a parameter filters allowing you, for example, to allow your user to invite only non-users, or only "already" users. Is it what you need ?
I don't know if you have the choice to use FBML or not, hope this could help a little at least.

Related

How to post on a friend's Timeline after the February 2013 migration takes effect?

Since Facebook is removing the ability to post to friends' wall via Graph API from February 6, 2013 onward, I want to know if there are some alternates to post to the friend's Wall.
Till now, I was using Feed API for this- using to parameter but it throws the exception:
(#200) Feed story publishing to other users is disabled for this application
The possible solution that I found was: OG: Mention Tagging. But is there a way to accomplish this other than by using OpenGraph? Please help.
But is there a way to accomplish this other than by using open graph?
Accomplish what exactly?
Tagging users/friends in any kind of posts? Only possible for Open Graph stories, or photos. (But be aware, apps are not supposed to tag users in photos if the user is not actually in it, or if it’s not a real photo, but just a composite image.)
Or posting to friend’s wall? This will only be possible using the Feed dialog from Feb. 2013 on.
The possibilty to post to friend’s walls via API will be removed in February 2013 – https://developers.facebook.com/roadmap/#february-2013:
If it fails for your app already, maybe you have the corresponding migration enabled in your settings? Anyway, not much point in developing such a thing now, since it won’t work any more in a week.
“We will remove the ability to post to a user's friends' walls via the Graph API. Specifically, posts against [user_id]/feed where [user_id] is different from the session user, or stream.publish calls where the target_id user is different from the session user, will fail.”
If you want to allow people to post to their friends' timelines, invoke the feed dialog. Stories that include friends via user mentions tagging or action tagging will show up on the friend’s timeline (assuming the friend approves the tag). For more info, see this blog post.
Edit:
#Sahil: See also this answer if it works now. I am not sure it will work now or not. But you should try once. I had made some workflow previously by selecting friend and inviting him and also posting on his wall also. I havn't tested this now, please confirm me.
If you use the to parameter with the Feed Dialog, you'll also need to specify a valid access token.
We actually had this same problem, which we solved by displaying the Feed Dialog as an iframe and dynamically adjusting the to param. You can find an in-depth answer + code sample here: https://stackoverflow.com/a/14532867/1406819
Check the FB.ui documentation for the feed method here: https://developers.facebook.com/docs/reference/dialogs/feed/
Setting the "to" parameter to a friend's ID will enable posting to a timeline.
to - The ID or username of the profile that this story will be published to. If this is unspecified, it defaults to the the value of from.
See the Properties detail lower on that page for more info.
Note that using this will trigger a confirmation dialog.
If you're using the JS SDK, here's something to get you started:
var MY_ID = "1000000000000";
function post(link, callback){
var post = {};
post.method = 'feed';
if(!link.target)
{
link.target = MY_ID;
}
if(!link.from)
{
link.from = MY_ID;
}
post.to = link.target;
post.from = link.from;
post.link = link.link;
post.name = link.name;
post.picture = link.picture;
post.caption = link.caption;
post.description = link.description;
FB.ui(post, function(response){
if(typeof callback=='function'){callback(response);}
});
}

How to get the facebook user id that likes my website (not a facebook site)

I am making a raffle within the people that had make an "I like" to a certain article of my external website (non facebook). In order to choose the winner I need to know who has made the I like.
This query:
https://api.facebook.com/method/fql.query?query=select%20like_count%20from%20link_stat%20where%20url='myWEBSITE'&format=json
Only get me the total count of I Likes but not the users ID
This query is perfect:
https://api.facebook.com/method/fql.query?query=SELECT%20user_id%20FROM%20like%20WHERE%20object_id%3D%MY_object_ID&access_token=MY_ACCESS_TOKEN
But how do I get an OBJECTID for an external url??
Thanks in advance
Object can be any thing like video, note, link, photo, or album but can not be any FB page or Url.. So I guess its not possible to get the user Id for a URL.
If you are using JS SDK / Like plugin in your website to like it, i think you can subscribe to an event and then use some ajax calls to get those userIds whenever they instantly like it.
See Somnath Muluk's answer in https://stackoverflow.com/a/13467793/269521

Get inviter for an event in facebook API

I have an application and I obtain the list of events for the current logged in user.
I can get the creator of the event but I just can't figure out how can I obtain the user who invited me to a certain event.
Sometimes the creator is not the same as the inviter. Already attending guests can invite other people.
Can I get this info using the facebook API?
Good question and nice-to-have feature but I think the actual Facebook API doesn't allow you to get that information.
The information you can get, about an event:
Graph API: http://developers.facebook.com/docs/reference/api/event/
FQL: http://developers.facebook.com/docs/reference/fql/event/
You could eventually use a "trick" like opening the event page in an iFrame or a popup. Then, with javascript or jQuery get the html contents of that iframe/popup and then get the part that says "FriendName invited you". FriendName = First and last name (+link to profile) of the inviter... It's a dirty solution and probably facebook has some security checks that won't allow this, but maybe it works, let me know ;)
Facebook added a new feature which will achieve what you are looking for. Event_Member's "Inviter" in Facebook's FQL will show you who the inviter is.
You can use FQL for that like:
SELECT inviter FROM event_member WHERE eid=146509188851970 AND uid=me()
You can see the example here:
Graph Explorer
Just remember to change the id of the event.

wall posts and fb:multi-friend-selector

Firstly i know that the documentation provided by Facebook says that fb:multi-friend-selector can be used in pair with fb:request-form and that it could only sends inviations or requests.
I have more specific need and that is not only to make invitations/requests but also along with the previous to post something on selected friends walls.
I've tried everything but i cant take the id's selected from the fb:multi-friend-selector, so i'm unable to make this posts.
The doucmentation for fb:multi-friend-selector says: This interface includes a series of which are included for selected users in the form that gets submitted to your action URL.
Is it somehow possible to catch this id's?
I'm working on my app in C# .net.
I read in some of the previous posts that is treating problematics similar to mine that is impossible to do this, but i found application that works perfectly in way that i want to make my application.
Thanks in advance,
Ivan
You can access the selected friend's id in the page that you are providing in "action" of fb:request-form.I am working with PHP so i am able to get those selected friend's id as $_REQUEST['ids'].So try some equivalent methods in c# for this.And if you get the friend's id you can publish to their wall.

Need to display friends list from facebook on to my app ? Need help in FBML

After authenticating the user, I need to get the users friends list.
I got the user name and photo by below code-
<'fb:profile-pic uid='loggedinuser' facebook-logo='true'><'fb:profile-pic> <br/>
"Welcome, <'fb:name uid='loggedinuser' useyou='false'><'/fb:name>.<br/><br/>
I need to display friends list here, please suggests how to do this with uid attribute in hand.
it's impossible doing this using only [x]fbml due there is no such feature
so you have to use JS FB.ApiClient.friends_get and then display the retrieved friends
ps: why this topic was at main page???? didn't even look at post date :-S