Update Your Code If You Use Facebook Multi-friend Selector

facebookWe normally use facebook multi-friend selector to invite our friends. Some applications also tracked the user ids to whom a user sent invitation. That is very easy to track because when we send invitation facebook will pass ids parameter that contains the invitation receiver ids.

But yesterday I noticed facebook changed their invitation functionality. That is after I send invitation facebook shows me a new email invite box. That wouldn’t be a matter to me, but I noticed the tracking records become duplicate.


Post Invitation

This is the invite code for iframe and fbconnect app

<fb:serverFbml style="width: 500px;">
    <script type="text/fbml">
                    content="Message<fb:req-choice url='<?=$appBaseUrl?>/requests' label='Accept' />"

                    actiontext="Demo Text">


After user sends invitation I save invited user ids by following way:

if (isset($_REQUEST['ids'])){
      //save $_REQUEST['ids'] to database table

It worked fine. But yesterday I noticed the ids saved as double. Then I search facebook platform live status and I found Multi-friend Selector Change

Here they said:

This page will not impact the requests or invitations sent in the previous step, but developers may receive duplicate notifications about which users were initially selected — one notification right after invitations to Facebook friends are sent and one notification at the end of the flow.

They also said:

To help developers differentiate between the two requests, we are including an additional POST parameter with each request sent to the form endpoint. The first request will contain fb_mfs_step=hidden as a parameter, and the second request will contain fb_mfs_step=display as a parameter. Developers should use the request with fb_mfs_step=hidden to do any data recording and processing, while the fb_mfs_step=display should be used only to display feedback to the user for successful completion of the flow.

So I fixed my code by the following way:

if (isset($_REQUEST['fb_mfs_step']) && $_REQUEST['fb_mfs_step'] === 'display'){
     echo "Invitation sent successfully! Thank You";

//save invitation
if (isset($_REQUEST['ids']) && isset($_REQUEST['fb_mfs_step']) && $_REQUEST['fb_mfs_step'] === 'hidden'){
      //save $_REQUEST['ids'] to database table

By this way I solved the duplicate entry issues. If you use similar technique previously to save user ids then update your code. Otherwise all tracking uids will be duplicate in database for same invitation.


  1. http://developers.facebook.com/live_status#msg_610
  2. http://developers.facebook.com/docs/reference/fbml/multi-friend-selector
  3. http://wiki.developers.facebook.com/index.php/Fb:multi-friend-selector
mahmud ahsan

Computer programmer and hobbyist photographer from Bangladesh, lives in Malaysia. My [Github | Business | Twitter | Linkedin | Youtube | Instagram | 500px]

You may also like


  • Andrew
    May 23, 2010 at 12:53 pm

    Hello, Have you been able to get these forms to work with the new Graph API? I’ve been attempting to create a multi-friend selector for an iframe canvas app (PHP) with no luck whatsoever, FBML just does not render…thanks

    • mahmud ahsan
      mahmud ahsan
      May 23, 2010 at 3:27 pm

      Andrew, yeah this code successfully rendered in new sdk based iframe app. Please check your application setting to provide fbconnect url in inframe app, also check if you correctly loading the javascript library or not. Otherwise the fbml will not render.

  • Willy Jansen
    May 23, 2010 at 3:50 pm

    Hi mahmud
    in my case, the “ids” that was normally posted before, now seems to be not sent out to my server. Instead of having duplicate entries, I did not get any record of invited friends since last May 18th.
    On do you add any new parameter due to this change?

  • Willy Jansen
    May 23, 2010 at 3:54 pm

    Btw I noticed something weird on your code.

    $_REQUEST[‘fb_mfs_step’] === ‘display’)

    why did you use ‘===’?

    thanks b4

    • mahmud ahsan
      mahmud ahsan
      May 23, 2010 at 4:28 pm

      Hi Willy, checkout this link http://php.net/manual/en/language.operators.comparison.php

      $a == $b Equal TRUE if $a is equal to $b.
      $a === $b Identical TRUE if $a is equal to $b, and they are of the same type. (introduced in PHP 4)

      • Willy Jansen
        May 23, 2010 at 4:43 pm

        Thanks a lot for the answer.

        Regarding the above problem, I have found the solution.

        • Aimee
          June 18, 2010 at 10:24 pm

          You say you found the solution – what was it? I am not getting IDs returned either

          • mahmud ahsan
            mahmud ahsan
            June 19, 2010 at 12:35 am

            Facebook restored their system again. So just check

            if (isset($_REQUEST['ids'])){
              //that means these user ids got the invitations. so you can track these ids.
  • Prasanna
    May 24, 2010 at 5:29 pm

    Thanks for sharing this article. Its very useful. I have Facebook IFrame application. I am using fb:multi-friend-selector control to invite friends. After sending invitation I saved the ids that were sent Invites/Requests. But, after I send invitation I got individually as ids[0], ids[1], etc. and facebook shows me a new email invite box.

    Please help me. How can I get the parameter name “ids[]” and would be a comma separated list of friend ids that were sent Invites/Requests?


    • mahmud ahsan
      mahmud ahsan
      May 24, 2010 at 10:17 pm

      Please read the article carefully. I mentioned ids[] in my code. Also read the comments of my code.

  • dthomas
    May 25, 2010 at 5:13 am

    Hello, I’m new to making apps for FaceBook but this is the final stumbling block before I’m finished with my first. Stumbled on this article while looking for a solution to my problem.. I read over your article several times and I was wondering where in the app the request code for the ids should go.. I’m not getting any ids variables passed to either the page the friend selector is on or the action page it goes to next.

    • mahmud ahsan
      mahmud ahsan
      May 25, 2010 at 12:14 pm

      yeah facebook pass ids to the action url you provided.

      • dthomas
        May 25, 2010 at 7:37 pm

        That’s what I thought, thanks for confirming for me. Just a quick follow-up if you don’t mind. I was also wondering if you are having trouble retrieving the ids? I’ve been using $uids = $_REQUEST[‘ids’]; to get them to work with but it seems they’re not getting passed.
        Thanks again

        • mahmud ahsan
          mahmud ahsan
          May 25, 2010 at 7:39 pm

          emm I’m not agree with you my friend. Because I found ids is passed in my iframe application.

          • Rick
            May 27, 2010 at 9:21 pm

            I am also not getting ids sent to my server.

            When I submit the invite I see a POST to

            apps.facebook.com/my-app/submit.php with ids[] and fb_mfs_step

            However it then does a GET to my server


            and the ids[] and fb_mfs_step are no longer there

          • mahmud ahsan
            mahmud ahsan
            May 27, 2010 at 11:53 pm

            Application development for facebook sometimes feels fucked up situation. Today I again found facebook changed their invitation system. Someday ago they provided email invitation after invitation send. Today I found they changed it again and redirect the form to the action url without showing the email invitation. So today I catch up invited users uids by the following way:

            if (isset($_REQUEST['fb_mfs_step']) && $_REQUEST['fb_mfs_step'] === 'display'){
            $inviteIds          =   isset($_REQUEST['ids']) ? $_REQUEST['ids'] : '';

            This solves my problem today. I don’t know whether that is a bug of them or they will change the system again.

          • Rick
            May 28, 2010 at 12:08 am

            Just wanted to follow up incase dthomas or others had the similar problem

            On the FB forums (where your blog was mentioned mahmud) http://forum.developers.facebook.com/viewtopic.php?id=59030

            They brought up that there is a difference in an iframe app that posts to apps.facebook.com/app_url vs yourdomain.com/app_url

            If you post directly to yourdomain.com/app_url then you get the IDs

          • mahmud ahsan
            mahmud ahsan
            May 28, 2010 at 3:28 am

            yeah ids will never sent to the apps.facebook.com/yourapp url and in my example code you’ll see i provided http://callbackurl and that is the server url. The technique I followed, the action url is my server url then after i added the info to db i redirected user to the apps.facebook.com/app url.

  • Willy Jansen
    May 28, 2010 at 2:16 pm

    In my db records, there has been no data from invited friends in the last two days. Facebook has changed them back to how it worked before, so I changed my code back.

  • Steve
    July 2, 2010 at 4:28 pm

    Do you know if there is a way to disable the email invite functionality completely?
    If I set the email_invite param to false (email_invite=”false”) in the fb:multi-friend-selector it makes no difference, most frustrating, I had this not appearing and all of a sudden I just cannot get rid of it.


    • mahmud ahsan
      mahmud ahsan
      July 2, 2010 at 6:48 pm

      Hmm…. but I also don’t know.

  • Ian
    July 5, 2010 at 5:50 am


    I’ve got the invite code working fine on my iframe canvas page but the problem I’m having is that after selecting the friends, the pop-up dialog that previews the invitation gets cut off on the right hand side by the facebook ads.

    Any idea how to make sure that dialog stays in the frame? It’s the only thing preventing me from launcing my app right now and I’ve seen a few people in the forums ask about it.


    • mahmud ahsan
      mahmud ahsan
      July 5, 2010 at 9:24 am

      I’m also facing the same problem and found no solution. 🙁

      • Ian
        July 5, 2010 at 9:53 am

        Crazy isn’t it? The posts I’ve seen about it have no solution either…but obviously some apps aren’t having issues. Considering inviting friends is the basis of most of FB’s interactions, you think this would be a priority.

  • Andrea
    July 6, 2010 at 6:55 am

    Sorry my idiot question….
    but when i retrive array $_REQUEST[‘ids’] which contain id fb users…. is my php script to notify invite or FB “framework” ???

    Sorry but I’m very confused….

    • mahmud ahsan
      mahmud ahsan
      July 6, 2010 at 11:11 am

      Facebook will automatically sends invitation to your selected friends, and return the $_REQUEST[‘ids’] as the selected friends ids. So you can save these ids to track yourself that which friends later visit from invitation.

      • Andrea
        July 6, 2010 at 2:52 pm

        Thank you for reply… i too think that…
        I receive $_REQUEST[‘ids’] but never invitation sent 🙁
        My code is similar on that in this post…
        Do you know problem ??

        P.S. Sorry for my bad english :S

        • mahmud ahsan
          mahmud ahsan
          July 6, 2010 at 3:05 pm

          It may be facebook temporary problem. Because invitation is auto sent by facebook not by us.

          • Andrea
            July 6, 2010 at 3:22 pm

            Ok thank you!!
            I will wait for news from Facebook…

      • awongh
        July 30, 2010 at 7:00 am

        I found out that the iframe the fbml generates is a default (for me at least) of around 900 pixels.

        What happens is that any popups that fb generates centers to that 900 pixel width.

        To fix this I had to set the width of iframes (all iframes) within a div containing all the fb code, with !important set so that fb can’t override that bit.

  • Noirita
    July 14, 2010 at 3:17 pm

    error in my above query –

    Suppose Mr. X has sent Mr. Y a fb application invitation. Mr Y can accept or ignore Mr X’s app invitation. If accepts how can we track invitation sender’s id, I mean whose invitation has been accepted by the invitee.
    Thanks in advance.

    • mahmud ahsan
      mahmud ahsan
      July 14, 2010 at 4:22 pm

      You have to make a trick here, you can send a url in the invitation, that means when the invited user accepts your invitation, facebook will redirect him the provided url. So if you passed a parameter like http://apps.facebook.com/myapp/index.php?invite=1 and in the index.php check if invite== 1 or not. By this way you can track invited users accepts the invite or not.

  • Justn Cribb
    July 22, 2010 at 12:21 am

    Hello is there a Javascript version for multi-friend selector for the new API? All I see in the docs is FBML. and the test console in Facebook Documentation is not working for me.


    Here is my FBML version. I want to do javascript so after clicking Invite Friends, javascript will do the job.

    <fb:request-form action="http://example.com"
    content="This is the content. ">

    Thanks for your help. By the way, I appreciate your articles. It’s like jumpstart Facebook. Yours is better than Facebook Docs. More power, Mahmud.

    • Justn Cribb
      July 22, 2010 at 12:26 am

      <fb:request-form action="http://site.com&quot;
      content="This is the content. “>

    • mahmud ahsan
      mahmud ahsan
      July 22, 2010 at 2:42 am

      Thank You.

  • Justn Cribb
    July 23, 2010 at 11:41 am

    I’ve come to know that Facebook announced some changes in multi-friend-selector. So it’s back to just $_REQUEST[‘ids’], for people who got stuck on this too. Facebook Docs is MADNESS!

    Updating the Multi-friend Selector
    Jun 8, 2010 5:52pm

    Based on tests conducted over the past few weeks, we are releasing improvements to the multi-friend selector, condensed multi-friend-selector, multi-friend-input, and friend-selector with tomorrow’s push.

    The new two-stage user interface makes it even easier for users to invite both their existing Facebook friends and their address book contacts to use your application. Despite this two-stage process, a single request will be sent to the form endpoint at the end of the flow. This request will contain the user IDs of invited Facebook friends as well as new Facebook user IDs for those address book contacts the user invited.

    We are discontinuing the use of the hidden parameter fb_mfs_step=hidden and fb_mfs_step=display in our tests.

    Similar to the multi-friend selector tested recently, selected address book contacts will receive an invitation to join Facebook with the name of the originating application included in the body of the email. If any of these contacts creates a Facebook account, the originating application will be bookmarked automatically for that user, and the user ID we passed to you initially will point to that new user.

    If these improvements alter the functionality of your application, you can disable the second stage of the flow so no address book contacts are invited. For the multi-friend-selector, add the attribute import_external_friends=false to the tag. For the condensed multi-friend-selector, multi-friend-input, and friend-selector, add the attribute import_external_friends=false to the tag. You can remove these attributes at any time to again allow users to invite their address book contacts and further promote your application.

    • canner
      November 8, 2010 at 4:17 pm

      thx for the hint with import_external_friends=”false” ! Searched a long time for that!

  • John
    August 11, 2010 at 6:59 am

    Can this be accomplished in a facebook pop-up dialog?

  • Ai Leen
    August 28, 2010 at 8:23 am

    Life saver! 🙂

    But could you get the Stream Attachment to work?

    I have this as my params but the Attachment does not show up.

    [method] => stream.publish
    [message] => test flash attachment
    [attachment] => [{‘media’: [{
    ‘type’: ‘flash’,
    ‘swfsrc’: ‘http://www.mapsofwar.com/photos/EMPIRE17.swf’,
    ‘imgsrc’: ‘http://icanhascheezburger.files.wordpress.com/2009/04/funny-pictures-hairless-cat-phones-home.jpg’,
    ‘width’: ’80’,
    ‘height’: ’60’,
    ‘expanded_width’: ‘160’,
    ‘expanded_height’: ‘120’

    [action_links] => [{“text”:”Create new tune”,”href”:”http:\/\/apps.facebook.com\/scratune\/”}]
    [target_id] =>


  • parul
    September 25, 2010 at 11:25 pm

    Hi, how to select all my friends, when i suggest to friends on pages…..

    old javascript to select all friends is not working…what to do

  • Rand
    October 30, 2010 at 5:14 am

    Thanks Justn! I have a mfs working well inside of an FBMLPopupDialog in an Iframe application. It is a Flash application. I need the dialog to close like it does with the close button when it is submitted with the skip buttons. I’ve figured out how to change the text on the skip buttons. I’ve seen code like this:

    action=”javascript: a[your_app_id]_doCloseDialog()”

    Where doCloseDialog() is a function, preceded by an underscore calling a function that calls hide() on the reference to the dialog box. I have not been able to get that or anything else to work. I’d rather it not leave the Flash application, but when I do get the action to go to a url, it stalls out. Strange behavior. I don’t know what it is doing. Anyway. Closing the dialog is what I really want as I do not need to track the data.

  • Rand
    November 8, 2010 at 10:06 pm

    Got it figured out. The action url must spell out the address of the Facebook post callback url exactly. Leaving it out or trying to use another address does not work. Once I got that I was able to javascript and close the dialog.

  • feng
    November 19, 2010 at 9:45 pm

    How do you take care of the url limit on GET request? If you invite 500 friends, the friend list will be too long?

  • mauricio
    December 9, 2010 at 2:02 am

    hey man! isn’t thah weird, why the skip button has to redirect user?! i don’t understan that part man!
    i mean, if i wanto to skip, i want to resume what i was doing not been redirected 😕
    that’s pretty anoying!

  • bashir
    December 21, 2010 at 3:46 pm

    I have a iframe facebook application.Iwant to invite friends from my index.php file in which place i will keep my invite code.
    please give answer as soon as possible.

  • Stefan
    December 30, 2010 at 12:46 am

    How to read IDs of friends from multi-friend-selector?


    I’m receiving only “signed request” when application is in iFrame mode… (in FBML mode works correctly)

  • jack petter
    January 4, 2011 at 2:11 pm

    Once again a great job….Always very informative and well thought out. Look forward to the next one!Your advice is very useful. Thank you
    Custom Fan Page

  • Fernando
    January 5, 2011 at 4:15 pm

    first of all thanks a lot for your work, everything is really well explained. But I have a problem maybe you can help me. When I try to get the users ids I have invited, I get nothing, here I show you my $_REQUEST after I send the invitations:

    [fb_sig_in_iframe] => 1
    [fb_sig_locale] => en_US
    [fb_sig_in_new_facebook] => 1
    [fb_sig_time] => 1294221259.872
    [fb_sig_added] => 1
    [fb_sig_profile_update_time] => 1280279022
    [fb_sig_expires] => 1294225200
    [fb_sig_user] => –myID–
    [fb_sig_session_key] => 2.d5_mcMMlMtVkZ9vbhK2dJw__.3600.1294225200—myID–
    [fb_sig_ss] => gljrYYVJgT2h8x41Q1tXpg__
    [fb_sig_cookie_sig] => fb67e652a971afe123c04363a71de5ee
    [fb_sig_ext_perms] => read_stream,status_update,photo_upload,video_upload,email,create_note,share_item,publish_stream,user_birthday,user_location,user_work_history
    [fb_sig_country] => tw
    [fb_sig_api_key] => —-
    [fb_sig_app_id] => —-
    [fb_sig] => —-

    As you can see no IDS… This is my code:

    include_once "fbmain.php";
    echo '’;
    echo ”;
    if (isset($_REQUEST[‘ids’])){
    echo “Invitation Successfully Sent”;
    echo ”;
    echo ”;
    echo “If you need to save these user ids then save these to database then redirect user to the apps.facebook.com/yourapp url“;
    $string = “top.location.href='{$fbconfig[‘appBaseUrl’]}’; “;
    echo “Use the following javascript code to redirect user “;
    echo htmlentities($string, ENT_QUOTES);
    else {

    content='This is an invitation! ‘>

    Any idea? Thank you very much.

  • Fernando
    January 5, 2011 at 4:16 pm

    The whole request form:

    content='This is an invitation! ‘>

    Thanks again.

    • Fernando
      January 5, 2011 at 4:18 pm

      Anyway, is almost the same as yours.

Comments are closed here.