by
KK » Fri Apr 25, 2014 1:38 am
@Gizmo,
Here is the 'Facebook Login' addon you asked for -
Installation:a. Extracting the attached zip will yield a folder named 'social-login'. Add this folder to the 'addons' folder of your Couch installation.
b. Add the following line to the 'addons/kfunctions.php' file
- Code: Select all
require_once( K_COUCH_DIR.'addons/social-login/facebook/facebook.php' );
Configuration:Since you are dealing with a Facebook app, I'm sure you know that this requires registering your app with Facebook and getting the 'App ID' and 'App Secret' keys.
These can be had by visiting
https://developers.facebook.com/apps/ and creating a new app.
Please google around if you are unsure about this step. I am assuming you have the two keys with you.
Edit the config.php file within the 'social-login' folder to add the keys info.
UsageLike the 'members' module, this module also relies on separate template of its own.
Create a template named '
fb.php' and put the following content within it -
- Code: Select all
<?php require_once( '../couch/cms.php' ); ?>
<cms:template title='Facebook Login' hidden='1' />
<cms:member_check_login />
<cms:if k_member_logged_in >
<!-- what is an already logged-in member doing on the login page? Send back to homepage. -->
<cms:redirect k_site_link />
<cms:else />
<cms:facebook_login />
<cms:if k_error >
<h3><cms:show k_error /></h3>
</cms:if>
</cms:if>
<?php COUCH::invoke(); ?>
Place this template with the other templates used by the members module (i.e. login.php, lost-password.php etc.)
By default these templates are expected to be in a folder named 'members' present in the site's root. If you have chosen to place the templates elsewhere, please edit 'addons/social-login/config.php' to set the new template name (the
<?php require_once( '../couch/cms.php' ); ?> statement in the template might also need to be modified accordingly).
The template we created above handles all the facebook login stuff in the background (specifically, the '<cms:facebook_login />' tag within it).
With it in place, we can now simply place a link to the template anywhere on the site where we offer the visitor to use Facebook for login.
A reasonable place to put this link would be the 'members/login.php' template that handles the regular login stuff.
Please add the following to the login template
- Code: Select all
<!-- Login via Facebook -->
<a href="<cms:facebook_login_link />" />Login with Facebook</a> <br>
and test things out.
Please let us know if this helps.
Thanks.