SSO Integration with a WordPress Blog
This is not really a support request but a small guide that someone might find useful in the future. If this should not be here, by all means, feel free to delete it.
Preamble
Codoforum does seem to be a nice alternative to what one is accustom to use, and because of that, one does need to learn the terminology this software uses for certain things (e.g. categories instead of forums); in this regard, IMO, the documentation could be a bit better... but I digress.
Now, IMO, the documentation could be a bit better also on how to integrate SSO with your blog/website... Last night, maybe I was more tired than usual to understand and follow the instructions on how to do it (I found the instructions a bit confusing), but after a while I got it to work as it should.
I'm aware there's a WordPress plugin to integrate SSO with Codoforum, but that didn't work for me, so I just deleted it.
Integrating SSO with WordPress
Note: I set this up locally using MAMP.
My set up is like this:
- WP Blog URL: http://localhost/codoforum/blog/
- Codoforum URL: http://localhost/codoforum/forum/
In Codoforum, my SSO settings look like this:

Note: since it looks truncated, in the SSO Login User Path field I'm redirecting back to the forum. The whole field value looks like this:
http://localhost/codoforum/blog/wp-login.php?redirect_to=http%3A%2F%2Flocalhost%2Fcodoforum%2Fforum%2F
My client.php files looks like this:
require 'sso.php';
define('ABSPATH', dirname(__FILE__) . '/');
include_once ABSPATH . '/wp-config.php';
$settings = array(
"client_id" => 'ssoCodoForum',
"secret" => 'seKreTkEy',
"timeout" => 6000
);
$sso = new codoforum_sso($settings);
$account = array();
$blog_user = wp_get_current_user();
$blog_username = $blog_user->user_login;
$blog_userID = $blog_user->ID;
$blog_userEmail = $blog_user->user_email;
if(isset($_COOKIE['PHPSESSID'])) {
$account['uid'] = $blog_userID;
$account['name'] = $blog_username;
$account['mail'] = $blog_userEmail;
}
$sso->output_jsonp($account);
exit();
Notice that since I need to pull the user's information from WordPress, I added these two lines of code:
define('ABSPATH', dirname(__FILE__) . '/');
include_once ABSPATH . '/wp-config.php';
Obvioulsy, my client.php and sso.php reside in the same directory where my wp-config.php does.
And then I'm assigning the properties of the wp_get_current_user() object to local variables. The rest of the code should be self explanatory.
At the beginning what confused me in the sample code was that the if() statement checking if the user is logged in had USER_IS_LOGGED_IN as its argument, which to me, was a constant, and I spent a bit of time trying to find where that constant was defined... obviously it turned out to be a placeholder... I know the comment above that line reads:
/**
*
* Here comes your logic to check if the user is logged in or not.
* A simple example would be using PHP SESSION
*/
But since, again, the argument looked like a constant to me, I thought that checking if a PHPSESSION was set was an alternative to using such "constant". Then I realized I was mistaken and changed my code accordingly.
Conclusion
I like the forum so far. I believe it has great potential and I want to learn it more... maybe to the point to develop plugins for it, and, as long time permits, maybe even be more active in the community (hopefully) helping others. We'll see.
Now, after a few more tests, I'm going to deploy my set up to my production server and see how it behaves live.
I hope these small steps can help someone save some time implementing SSO with their WP blog.
Thanks!