WordPress SSO Integration Guide
From KickApps API Reference
Contents |
Overview
The KickApps SSO plugin for Wordpress allows a seamless login experience between your Wordpress members and your KickApps-powered community. When your members login to your Wordpress site, they will be auto-signed in to your KickApps community.
If you have an existing Wordpress site with existing members, as these members sign into your Wordpress site, they will be auto-registered into your KickApps community, so no initial user import into KickApps is required.
Just follow these simple steps and you'll be up and running in no time!
Note on Versions:
This plugin has been tested with 2.1, 2.2, and 2.3 versions of Wordpress successfully.
Setup
- First and foremost create a KickApps account at www.kickapps.com. Note: when signing up as a KickApps affiliate, use a different email address than the one you're using for your WordPress admin account.
- Log into the KickApps Affiliate Center and browse to Configure > Advanced > Single Sign‐On. You’ll find a table of required information on this page. Note down the exact values for Username, Email, and Site Name. Then, under “Activate SSO”, click “Yes”.
- Grab the KickApps Single Sign on Wordpress plugin
- Download and install the Wordpress plugin into your Wordpress instance by unzipping the contents to your wp-content/plugin location
- Edit your wp-config.php file in the base directory of your Wordpress installation to add session_start(); directly below the opening <php. For example:
<?php
session_start();
// ** MySQL settings ** //
define('DB_NAME', 'WordPress'); // The name of the database
define('DB_USER', 'root'); // Your MySQL username
define('DB_PASSWORD', 'root'); // ...and password
define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
// You can have multiple installations in one database if you give each a unique prefix
$table_prefix = 'wp_'; // Only numbers, letters, and underscores please!
// Change this to localize WordPress. A corresponding MO file for the
// chosen language must be installed to wp‐content/languages.
// For example, install de.mo to wp‐content/languages and set WPLANG to 'de'
// to enable German language support.
define ('WPLANG', '');
/* That's all, stop editing! Happy blogging. */
define('ABSPATH', dirname(__FILE__).'/');
require_once(ABSPATH.'wp‐settings.php');
?> - Enable the user plugin via the Wordpress plugin management interface
- Configure the plugin in Wordpress with the three values (username, email, site name) you noted above.
- Log into the Affiliate Center and browse to Configure > Advanced > Single Sign-On.
- Fill out the fields as follows to point all KickApps related login/registration links to your WordPress site.
- Registration
- Point to your Wordpress register page e.g. http://www.mywordpress.com/wp-login.php?action=register
- Sign-on
- Point to your Worpress sign-in page (or the site's home page, where the login form sits by default) e.g.
- http://www.mywordpress.com/wp-login.php
- Forgotten password
- Point to your Wordpress forgot password page e.g.
- http://www.mywordpress.com/wp-login.php?action=lostpassword
- Sign-out destination
- Point to your Wordpress home page e.g.
- http://www.mywordpress.com/wp-login.php
- Registration
- Create widgets in the Affiliate Center (using the App Studio), and paste them into your articles, posts, flat HTML, anywhere you like! Note: You must use the 'Compatible Version' of the widget embed code.
User Experience
- Users that are already signed in to your Wordpress site
- When clicking through to your KickApps powered community pages, they will be automatically signed into the KickApps community.
- Users that have not yet signed in to your Wordpress site
- When clicking through to a KickApps powered community page, they will not be signed in (obviously... since they have not signed in to the WordPress site).
- Clicking on a 'login' link on a KickApps page directs the user to your WordPress login page.
- Clicking on a 'join' link on a KickApps page directs the user to your WordPress registration page.
- When clicking through to a KickApps powered community page, they will not be signed in (obviously... since they have not signed in to the WordPress site).
Already have a KickApps community?
For the most part, with the release of this plugin, WordPress administrators will look to newly add KickApps Social Media functionality to their existing WordPress sites. As mentioned, no WordPress member export is necessary to make this happen.
However, if you already have a KickApps community and want to use that membership in your WordPress site, you will need to contact KickApps support to request an export of your KickApps members such that you can import them into your WordPress community.
How to add a KickApps Widget to your WordPress
- In a page, post or comment:
- Log in to the KickApps Affiliate Center
- Click the App Studio tab
- Create and save a widget ( learn how)
- Select Menu > Publish
- In the window that pops up, make sure that Compatible Embed Code is selected in the embed code dropdown, then click the Copy Embed Code button.
- Create a new comment, post, or page in WordPress
- Paste the widget into the entry form and surround it with <code></code> tags
- In the header, footer, or sidebar:
- Log in to the KickApps Affiliate Center
- Click the App Studio tab
- Create and save a widget ( learn how)
- Select Menu > Publish
- In the window that pops up, make sure that Compatible Embed Code is selected in the embed code dropdown, then click the Copy Embed Code button.
- Edit the text of the widget to add the following to the end of the src attribute (on Classic Widgets) or on the FlashVars param element and the FlashVars= attribute (On App Studio widgets):
<?php echo '&st='.$_SESSION['ka_st'].'&tid='.$_SESSION['ka_tid'] ?>
For example:<p width="100%" align="center">
<object classid="clsid:d27cdb6e‐ae6d‐11cf‐96b8‐444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"
type="application/x‐shockwave‐flash" width="300px" height="400px" id="kickWidget_12831_11258" align="middle">
<param name="movie" value="http://serve.a‐widget.com/kickapps/service/getWidgetSwf.kickAction"/>
<param name="FlashVars" value="<?php echo '&st='.$_SESSION['ka_st'].'&tid='.$_SESSION['ka_tid']
.’&’?>affiliateSiteId=12831&widgetId=11258&width=300&height=400"/>
<param name="quality" value="high"/>
<param name="wmode" value="transparent"/>
<param name="allowFullScreen" value="true"/>
<param name="menu" value="false"/>
<param name="allowNetworking" value="all"/>
<param name="allowScriptAccess" value="always"/>
<embed src="http://serve.a‐widget.com/kickapps/service/getWidgetSwf.kickAction"
name="kickWidget_12831_11258" width="300px" height="400px" quality="high" menu="false"
pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x‐shockwave‐flash"
wmode="transparent" align="middle" allowScriptAccess="always" alt="KickApps Widget" allowFullScreen="true"
FlashVars="<?php echo '&st='.$_SESSION['ka_st'].'&tid='.$_SESSION['ka_tid']
.’&’?>affiliateSiteId=12831&widgetId=11258&width=300&height=400"/>
</object>
</p> - Paste the modified widget into the php page
Troubleshooting:
Q. I see the following error in the error log: KickApps SSO: Unable to register user admin. E_USER_REGISTRATION_ERROR A. You must modify the email address of the user 'admin' for your Wordpress site to be different then the email address used for the KickApps Affiliate Site.
Q. When I pasted in my widget and click through after login it still asks me to login to the KickApps site. A. Ensure you used the 'Compatible Version' of the widget embed code and followed all of the steps above.
Q. I receive the following error in the error.log: “PHP Fatal error: Class 'SOAPClient' not found in” A. By default the PHP installer does not have the SOAP extension enabled but the zip package does. To enable this extension for the windows PHP install:
- Go to PHP.net
- Go to downloads and choose the windows zip package under windows binaries
- Unzip the page and copy the php_soap.dll to the ext directory of the php installation
- Open the php.ini in the base directory of the php installation and add the following line:
extension=php_soap.dll
- Save the php.ini
Note: You may need to restart apache to pickup the php.ini change.