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.

All other Modules /

Discuss all other Modules here.

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

Facebook Connect instructions don't make sense at all!


Reply


4 Posts   663 Views

Avatar
grez868

Community Member, 3 Posts

21 April 2012 at 11:32pm

Edited: 21/04/2012 11:42pm

I am trying to install Facebook Connect to my SilverStripe sites and the information provided by Willrossi on github is a load of rubbish. When he says to put something somewhere he never specified actually WHERE.

such as:

You need to add the fb: namespace to your Page.ss file. For example your tag at the top should look like

<html lang="en" xmlns:fb="http://www.facebook.com/2008/fbml">

^ he doesn't even say which of the three page.ss files to use or all.

----

If you haven't disabled the FacebookConnect::$create_member variable you can access the Facebook's member information by using:

<% control CurrentMember %>
$FirstName $LastName $Avatar(small)
<% end_control %>

^ In the above he doesn't say where this variable even is...for someone who doesn't know SilverStripe that much yet this is just sub-standard guidance.

----

and also

Once you have done that you should be able to use the includes provided in this module.

<% if CurrentFacebookMember %>
<p>Hi $CurrentFacebookMember.FirstName</p>
<% include ConnectLogout %>
<% else %>
<% include ConnectLogin %>
<% end_if %>
You can also access the Facebook member information in your PHP code. The Facebook API connection and current member are cached on the controller object. So for example if this is in your Page_Controller class

// returns the current facebook member (wrapped in a SS Member Object)
$this->getCurrentFacebookMember();

// returns the API connection which you can use to write your own query
$this->getFacebook();

^ Once again, above he doesnt mention anything about where all this would go!

Is anyone able to write a proper guide which explains things properly?

Avatar
Juanitou

Community Member, 323 Posts

22 April 2012 at 6:15am

Edited: 22/04/2012 7:45am

Hello,

Is anyone able to write a proper guide which explains things properly?

Yes, certainly, but the risk of it being considered “a load of rubbish” by someone that has not taken the time to understand the basics of SilverStripe kind of disheartens me!

Good luck in getting help,
Juan

Avatar
Willr

Forum Moderator, 5513 Posts

22 April 2012 at 8:47pm

Sorry I can't explain everything in minuscule detail. Let me try clear it up

^ he doesn't even say which of the three page.ss files to use or all.

I recommend reading the tutorial on making themes with SS. That explains the concept of the 'Page.ss' files and you should find that only 1 includes a <html> tag! but to avoid any more confusion you want the themes/yourtheme/templates/Page.ss file, replacing of course yourtheme with the name of the theme you're using. You should see a existing <html> tag in there which you will need to replace. In blackcandy it's line 2 (https://github.com/silverstripe-themes/silverstripe-blackcandy/blob/master/blackcandy/templates/Page.ss#L2)

^ In the above he doesn't say where this variable even is...for someone who doesn't know SilverStripe that much yet this is just sub-standard guidance.

Ah I just said what the variable is FacebookConnect::$create_member is the $create_member variable on the FacebookConnect class. Just like configuring any other variables in SS you can just put that line in your mysite/_config.php to configure eg

FacebookConnect::$create_member = true; // OR
FacebookConnect::$create_member = false;

^ Once again, above he doesnt mention anything about where all this would go!

It can go where ever you want it to go! I don't know what your HTML looks like or if your website is designed any way but it needs to go in one of your template files (i.e Page.ss if thats where you want it!). Most devs do custom themes with their own designed templates so they need to decide where they wish to place the facebook login information.

If you're new to SS, be aware that it's not an 'out of the box' system as Wordpress etc so while the docs are poor, it's also the design of the framework to leave specific configuration and implementation to developers and the modules don't prescribe any set rules you may be used to other frameworks.

Get in touch if you have any other questions on the module!

Avatar
grez868

Community Member, 3 Posts

22 April 2012 at 9:37pm

Aah okay thanks for helping me clear it up Will :)

And juanitau - i was merely saying that the instructions on GitHub weren't as full of information as they need to be for people new to the cms system who don't know php that well and don't want to spend months reading each line of code. Your comment was quite unhelpful for anyone who doesn't already have an extensive knowledge and what you posted only damages the good design and reputation of a brilliant script. If you wanted to avoid the disheartening risk then all you had to do was say where things could go like will did above.