Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

facebookconnect-silverstripe


Go to End


21 Posts   7605 Views

Avatar
dacar

Community Member, 173 Posts

5 October 2010 at 5:56pm

Hi nimeso,

unfortunately not.

@willr: i am not using SSL. It is facebook, who usese SSL: 0 => 'https://graph.facebook.com/me'. Is there anybody who got this working?

Avatar
bummzack

Community Member, 904 Posts

5 October 2010 at 6:32pm

Add the following line before any FB-calls are being issued (preferably just one line before you do new Facebook(...))

Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false;

Worked for me, although I don't use Willrs FacebookConnect class.

Avatar
dacar

Community Member, 173 Posts

5 October 2010 at 10:30pm

hi banal,

i have tried your suggestion and put CURLOPT_SSL_VERIFYPEER => false to line 92 in facebookconnect/code/client/Facebook.php:

  /**
   * Default options for curl.
   */
  public static $CURL_OPTS = array(
    CURLOPT_CONNECTTIMEOUT => 10,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT        => 60,
    CURLOPT_USERAGENT      => 'facebook-php-2.0',
	CURLOPT_SSL_VERIFYPEER => false,
  );

Then i get an error in my logs:
[05-Oct-2010 10:58:10] PHP Fatal error: Call to undefined method Group::add_to_group_by_code() in /home/www/22/42/cwflade549/facebookconnect/code/FacebookConnect.php on line 216

in 216 of FacebookConnect you will find the following:

if($groups = self::get_member_groups()) {
						foreach($groups as $group) {
							Group::add_to_group_by_code($member, $group);
						}
					}

Without Group::add_to_group_by_code($member, $group); the Login works.

Questions:
1. I have set FacebookConnect::set_member_groups('facebook-members'); in my _config.php. Why can't i add the member to the db?
2. If i use the "login as an other user" Button, i get the following, but why?

[User Warning] Already directed to https://www.facebook.com/logout.php?api_key=155555175293223&next=http%3A%2F%2Fwww.flavourtripping.de%2FSecurity%2FLoginForm&session_key=2.TRU355555mQjU1C8YvG5g__.3600.1286276400-1513896489; now trying to direct to http://www.flavourtripping.de/Security/Login

3. If i use the "login as an other user" Button from the facebook tab, i get the following, but why?
The action 'FacebookLoginForm' does not exist in class Security

by the way: have you seen the new social media featrures on http://www.samsung.com/us (at the bottom of the page). This would be cool features for a modul.

Greetings, Carsten.

Avatar
bummzack

Community Member, 904 Posts

5 October 2010 at 11:06pm

Hey Carsten

I'm sorry, I can't help you out with the FacebookConnect code, since I never used it before. I'm using the facebook class directly in a current project.
Apparently the CURLOPT_SSL_VERIFYPEER option seem to have helped.
Maybe Willr can give you a hint regarding the issues with Group.

Avatar
dacar

Community Member, 173 Posts

6 October 2010 at 1:38am

Edited: 06/10/2010 1:38am

Questions:
1. I have set FacebookConnect::set_member_groups('facebook-members'); in my _config.php. Why can't i add the member to the db?
you have to change it to: $member->addToGroupByCode($member, $group); to make it work!

2. If i use the "login as an other user" Button, i get the following, but why?

[User Warning] Already directed to https://www.facebook.com/logout.php?api_key=155555175293223&next=http%3A%2F%2Fwww.flavourtripping.de%2FSecurity%2FLoginForm&session_key=2.TRU355555mQjU1C8YvG5g__.3600.1286276400-1513896489; now trying to direct to http://www.flavourtripping.de/Security/Login

There seems to be a problem with $backURL in FacebookLoginForm.php?!

3. If i use the "login as an other user" Button from the facebook tab, i get the following, but why?

The action 'FacebookLoginForm' does not exist in class Security

Avatar
nimeso

Community Member, 17 Posts

6 October 2010 at 2:12pm

Figured this out if anyone is wants to know....

you need to add

$opts[CURLOPT_SSL_VERIFYPEER] = false;

in the makeRequest() method of FaceBook.php

so it looks like

protected function makeRequest($url, $params, $ch=null) {
if (!$ch) {
$ch = curl_init();
}

$opts = self::$CURL_OPTS;
$opts[CURLOPT_SSL_VERIFYPEER] = false; // Add this in

Avatar
bummzack

Community Member, 904 Posts

6 October 2010 at 6:38pm

Edited: 06/10/2010 6:39pm

@nimeso
If you would have read the previous posts, you could have noticed that we figured that out already :)

Btw: Usually you should avoid changing third party libs like the Facebook class because all your changes will be lost whenever you upgrade to a new version. That's why options like CURLOPT_SSL_VERIFYPEER are made static and can be changed from outside the code. So in your Code, you can set:

Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false; 

before you issue any Facebook calls. This can be in Page.php or anywhere else and you don't have to modify facebook.php directly.

Avatar
dacar

Community Member, 173 Posts

6 October 2010 at 8:37pm

@willr: do you have an idea about the last two problems i have withe your facebooc-connct?

1. If i use the "login as an other user" Button, i get the following, but why?

[User Warning] Already directed to https://www.facebook.com/logout.php?api_key=155555175293223&next=http%3A%2F%2Fwww.flavourtripping.de%2FSecurity%2FLoginForm&session_key=2.TRU355555mQjU1C8YvG5g__.3600.1286276400-1513896489; now trying to direct to http://www.flavourtripping.de/Security/Login

There seems to be a problem with $backURL in FacebookLoginForm.php?!

2. If i use the "login as an other user" Button from the facebook tab, i get the following, but why?

The action 'FacebookLoginForm' does not exist in class Security