You Are Here: Home » How-To » Programming

How To Integrate PHPFox & Question2Answer Q2A Single Sign-on?

By Debjit on February 13th, 2014 
Advertisement

PHPFox is a pretty well known social networking website CMS that can help you set up a full blown Facebook like social network website in less than 10 minutes.

Although the PHPFox script comes at a steep price of US $99 but is totally worth it when it comes to giving a social networking feature to the users of your website. In addition to a social network, another feature that your users will definitely love is a Question & Answer forum where they can ask various questions and get help.

PHPFox Q2A Integration Logo

PHPFox Q2A Integration

In this article we will tell you how to integrate two popular scripts PHPFox and Question2Answer Q2A in order to provide a single sign-on experience to your users on PHPFox so that whenever the users are logged into your PHPFox powered social network, they will all be automatically logged into your Question2Answer Q2A installation.

First and foremost, you need to ensure that this is a new / fresh Q2A installation and you are not trying to implement this using an existing installation of Q2A. In this tutorial we assume that you have placed Question2Answer in a folder inside your PHPFox installation, meaning if your PHPFox site is http://phpf.ox then Question2Answer can be accessed at http://phpf.ox/qa.

Lets now do the two most important steps:

1. Open the qa-config.php file and set the QA_EXTERNAL_USERS property to true in around line number 115 and save the file. It should look like this now:

define('QA_EXTERNAL_USERS', true);

2. Now rename the folder qa-external-example to just qa-external and in side the folder there is a file named qa-external-users.php, make a copy of this file and rename it to qa-external-users-default.php (just as a backup). Now open the qa-external-users.php file and locate the function named qa_get_mysql_user_column_type(). Now totally remove that function including all its comments and replace with following function code:

function qa_get_mysql_user_column_type()
{
return 'INT UNSIGNED';
}

We are now all set to install Question2Answer with single sign-on support. This is just the beginning and there are some more important steps to be covered before we can fully setup Single Sign-on between Q2A and PHPFox. Navigate to the Q2A path in your browser (something like we assumed above http://phpf.ox/qa). You should then be able to see the following screens:

Q2A PHPFox Integration - User column integer

Q2A PHPFox Integration - User column integer

You can notice that Question2Answer has been able to detect that you are going to install a Single Sign-on environment. Now lets take a look at the next step after you click on the Create Database button.

Q2A PHPFox Integration - Single sign-on

Q2A PHPFox Integration - Single sign-on

Now starts the main ordeal where we will customise various functions needed for the PHPFox - Question2Answer Single Sign-on to work. There are 5 functions in the qa-external-users.php file that we will have to modify compulsorily in order to get the PHPFox - Q2A integration to be complete.

There are 4 additional functions in that file which will provide some user display related enhancements and are not compulsory to be implemented. Apart from these we will also need to work on the PHPFox Autoloader that will import the PHPFox environment (including user sessions) into Question2Answer for the user that is currently logged on to PHPFox.

Here are the 3 major steps that are needed to be taken in order to complete the integration, please follow them in the given order:

You can also hire us developers to do the Q2A and PHPFox integration / SSO setup for your websites, just drop a mail to [email protected]

Advertisement







How To Integrate PHPFox & Question2Answer Q2A Single Sign-on? was originally published on Digitizor.com on February 12, 2014 - 7:32 am (Indian Standard Time)