× Joomla Facebook Connect support forum

Topic-icon Sending Request via app request dialogue

Active Subscriptions:

None
14 years 9 months ago #13215 by Ivan
I've managed to get a list of friends displayed on a module by making a graph api request. What i need to achieve is to be able to click on a friends avatar and send them a request. Ive asked on stackoverflow and they said it cannot be done via the graph api. Please see this thread:


click here stackoverflow thread



I tried to put the javascript Request code in the system plugin but when i make the javascriopt call it tells me the function is not defined. If i put the request code within the module where im showing the friends list i get an error:

c is null
[Break On This Error] FB.provide('Dom',{containsCss:function...(oldonload);}else oldonload();};})();


here is the code i use:

in the facebook.php i added :
   function getFriendsList(){
    
    $response = $this->api('/me/friends'); 
     return $response;
    
    }

this is what gets the friends list and then i display the data.

I try to make and onclick event in the module where i display the friends list :

[code]
getUserId(TRUE);

//If FB User
if($fbUserId){

$f_list = $fbClient->getFriendsList();
//dump($f_list);

foreach ($f_list as $friend) {
for($i = 0; $i LESSTHAN count($friend); $i++)
{

echo ''.$friend[$i].'';
}
}
}

?>


function sendRequest(to) {
FB.ui({method: 'apprequests', to: to, message: 'You should learn more about this awesome site.', data: 'tracking information for the user'});
return false;
}
The topic has been locked.
Support Specialist
14 years 9 months ago #13218 by alzander
For the JFBC 4.1 or 4.2 release, we're planning to implement the new requests system (and replace our JFBCInvite module), but haven't scoped out which release that will be in. Additionally, I haven't done a huge amount of research into it yet... but will help where I can.

First, the FB.provide function can be thrown off a few ways we've seen in the past. Check for these problems:
1) You don't have any other scripts including the all.js Facebook library. JFBConnect is usually tolerant to other inclusions, but some functions in the Facebook library can really go crazy if that library is included twice on the page.
2) Make sure you're not including any of the other Facebook libraries on the page, especially the Share button in any form.

Next, for the 'new' requests, in your Facebook application, in the Info->Advanced tab, there's a "Migrations" section. One of the settings here is for "Use Requests 2.0", or something similar. I believe that needs to be enabled.

Looking through the docs for the apprequests API:
developers.facebook.com/docs/reference/dialogs/requests/

The only thing I see wrong with your function call is that the to: to should be in quotes. Since that parameter can accept IDs or usernames.. I think passing it in without quotes may be causing the function problems. Also, I'd recommend alerting out the ID of the user, just to make sure it's being passed into that function properly.

Hope that helps, and definitely let us know how that goes. Again, we're planning some robust support for the Invitations in an upcoming release, so you're feedback on implementing it would be great to hear!

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
14 years 8 months ago #13276 by Ivan
Hey alex, i check most of the the above but i still get the error

c is null
[Break On This Error] FB.provide('Dom',{containsCss:function...(oldonload);}else oldonload();};})();

I also ran across this thread:

stackoverflow.com/questions/6730906/usin...ined/7383100#7383100

but i cant find that code section in mootools to edit.
The topic has been locked.
Support Specialist
14 years 8 months ago #13324 by alzander
I'm not sure. I wouldn't recommend modifying Mootools, in all honesty, and that post doesn't describe what version of Mootools has the issue. They also mention that that's in the uncompressed version. You may want to try the compressed version (if you aren't already) to see if that rectifies the problem.

Unfortunately, I don't know anything else about that error and have never encountered it before, so am not sure we'll be able to help much.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
14 years 8 months ago #13396 by Ivan
Hi Alex,

After updating to jfbconnect4.1 the method above now works.
The topic has been locked.
Support Specialist
14 years 8 months ago #13401 by alzander
Fantastic! In 4.0, we updated the Mootools checking logic. There weren't any changes in the 4.0.1 release that came out today that I think would help your problem.. but either way, glad you're going now!

Alex
The topic has been locked.