Note that there are some explanatory texts on larger screens.

plurals
  1. POFacebook requests 2.0 filter
    primarykey
    data
    text
    <p>So I hope someone call help me with this issue as I'm not too sure if its javascript, or if its facebook. </p> <p>Here's my situation. I upgraded to Requests 2.0 on facebook, which no longer gives me the ability to add an exclude_ids field to the form where users will invite their friends to the App. The purpose of this form is not to just invite friends, but to add friends as something in the App. </p> <p>In short, I have a list of friends that they have already added, and I want to filter that from the master list of their friends so that when they want to use the form, the friends already added do not show up.</p> <p>Here is my javascript to get the friends:</p> <pre><code>&lt;script language="Javascript" type="text/javascript"&gt; var friends_filter = '&lt;?=$myClass-&gt;getFiltered());?&gt;'; &lt;/script&gt; </code></pre> <p>Will return something like:</p> <pre><code>999999999,999999999,999999999,999999999,999999999,999999999,999999999 </code></pre> <p>Which is a list of IDs of the users who they have NOT added that are their friends.</p> <p>Here is my code for the form:</p> <pre><code>function addUser() { FB.ui( { method: 'apprequests', display: 'dialog', title: 'Add friends', message: 'Hey, I added you as a user/friend on such-and-such App', data: 'added', filters: [{name: 'Non-Added', user_ids: [friends_filter]}], }, function(response) { if(response &amp;&amp; response.request_ids) { showLoading('Adding Relatives'); var dataString = 'rids='+response.request_ids; $.ajax({ type: "GET", url: server_url+"ajax/add_relative.php", data: dataString, success: function(data){ window.location.reload(); } }); } } ); } </code></pre> <p>If you look at the <code>filters: [{name: 'Non-Added', user_ids: [friends_filter]}],</code> line, that is where I include the list of IDS that I only want to see in the selector. The dialog pops up, but then list those ID's in <code>friends_filter</code> and an error message stating "does not resolve to a valid user ID"</p> <p>This is where I get confused, if I copy and paste what <code>friends_filter</code> outputs and replace it the <code>friends_filter</code> with the list of IDs, i.e. <code>999999999,999999999,999999999,999999999,</code> exactly as it appears, it works correctly.</p> <p>I know this is an exhaustive post and I'm sorry, but I'm at my wits end. </p> <p>The only thing I could think of is that perhaps my javascript variable <code>friends_filter</code> needs to be converted to some type of some sort?</p> <p>Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload