Show Categories
515
1
gmdolfint posted Dec 8 '15 at 11:15 pm

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:

5667599b329ea.png

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';

/**
 * 
 * The SSO client id and secret MUST be same as that set in the Codoforum
 * SSO plugin settings
 */

$settings = array(

  "client_id" => 'ssoCodoForum',
  "secret" => 'seKreTkEy',
  "timeout" => 6000  
);

$sso = new codoforum_sso($settings);

$account = array();

/** getting wordpress user info **/
$blog_user = wp_get_current_user();
$blog_username = $blog_user->user_login;
$blog_userID = $blog_user->ID;
$blog_userEmail = $blog_user->user_email;


/*
 * 
 * Here comes your logic to check if the user is logged in or not.
 * A simple example would be using PHP SESSION
 */

if(isset($_COOKIE['PHPSESSID'])) {
    $account['uid'] = $blog_userID; //current logged in user's userid
    $account['name'] = $blog_username; //current logged in user's username
    $account['mail'] = $blog_userEmail; //current logged in user's email id
    //$account['avatar'] = ''; //not used as of now
}


$sso->output_jsonp($account); //output above as JSON back to Codoforum
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!

1k
28
steve posted Nov 30 '15 at 12:01 am

Well first of all i would like to say this is an awesome forum script you have developed here.

Now on to my issue, i have been attempting to merge the logins for my existing site and the forum script using the sso plugin. I followed the directions closely from the install page, and it does link to the login page of my website, but when logging in it doesnt in turn log me into the forum. Hope i am making sense so far.

What is baffling me though, is the logout on my main website will also log me out of the forum once logged in manually using the user/pass i created when installing the forum script.

in the client.php at the bottom

$account['uid'] = [i have actual username here from my website]; //Your logged in user's userid
$account['name'] = [username from website]; //Your logged in user's username
$account['mail'] = [my physical email address]; //Your logged in user's email id
$account['avatar'] = ''; //not used as of now

Not sure where i have gone wrong with this one :/

recent by steve  ·  Dec 10 '15 at 12:53 am
156
6

Hi

In the back end there is a setting controlling in how many minutes the uploaded files will be deleted (I suppose from the server).

I send (upload) a file in the chatroom and this file should be deleted after 3 min according to the setting I put.
However it seems that it doesn't work because the file is still in the uploads directory in the server.

Thanks.

recent by dm  ·  Dec 5 '15 at 7:02 am
280
4
Cody posted Dec 3 '15 at 4:05 am

Hi Everyone,
I have successfully installed CodoForum. I am trying to make it private (I just DENIED all the guest permissions), I would like my users to be able to come onto my website, and be able to click the 'register' button, and sign up (obviously after admin approval).
But when I test it and click 'register' it takes me to some 'http://localhost/page/user/lot' page. I went into the settings of the sso plugin but I have no idea what info to enter in.

If you can help that would be great!
Thanks

recent by Cody  ·  Dec 5 '15 at 2:17 am
190
1

I have installed Freichat in my personal site through customized option. But I'm getting the following error:

Could not authenticate user . Please verify your edited copy-paste code and make any required changes

My code snippet is as follows:

if(isset($_SESSION["user_id"]))
{ 
    //echo "select user_id from user_account_master where SGM_MEM_ID='".$_SESSION["user_id"]."'";
    $q10=mysql_query("select user_id from user_account_master where SGM_MEM_ID='".$_SESSION["user_id"]."'");
    $r10=mysql_fetch_array($q10);
    $ses=$r10["user_id"]; //tell freichat the userid of the current user
//echo "Session User".$r10["user_id"];
    setcookie("freichat_user", "LOGGED_IN", time()+3600, "/"); // *do not change -> freichat code
}
else {
    $ses = null; //tell freichat that the current user is a guest
//echo "Guest";
    setcookie("freichat_user", null, time()+3600, "/"); // *do not change -> freichat code
}
//$ses=null;
echo "Test".$ses;

if(!function_exists("freichatx_get_hash")){
function freichatx_get_hash($ses){

       if(is_file("/home/simplyge/public_html/test/freichat/hardcode.php")){

               require "/home/simplyge/public_html/test/freichat/hardcode.php";

               $temp_id =  $ses . $uid;

               return md5($temp_id);

       }
       else
       {
               echo "<script>alert('module freichatx says: hardcode.php file not
found!');</script>";
       }

       return 0;
}
}

Please help.

394
2
Cody posted Dec 2 '15 at 4:44 am

HELP - I am receiving this error when installing codoforum:
Uh oh, a problem occured!
|

Please make following files/folders writable

sites/default/config.php
sites/default/assets/img/attachments/
sites/default/assets/img/cats/
sites/default/assets/img/cats/icons/
sites/default/assets/img/profiles/
sites/default/assets/img/profiles/icons/
sites/default/assets/img/smileys/
cache/

Does anyone know what this means and what I should do?
Thanks!

recent by Cody  ·  Dec 3 '15 at 3:16 am
384
10

Hi Everyone,
I am a real beginner to this. I have downloaded an uploaded CodoForum to my (free) 000webhost account. Now I don't know what to do, the documentation says:
"Visit the location in your web browser and follow the instructions in the installer."
But I have no idea how to do this. If someone could give me some REALLY basic instructions (how to access and set up the forum) that would be really great.
Look forward to your reply!
Cody

recent by Cody  ·  Dec 3 '15 at 3:16 am
456
15

@adesh @avinash @admin
Hi developers how can I submit a proper sitemap to Google ?.Create a plugin or directly integrate a sitemap functionality in backend that will automatically update the sitemap after every day and also admins can update it in any time ! I tried the sitemap plugin from Github but its not working for me ! Please help.smile
Thanks in advance.

recent by nguoianphu  ·  Dec 3 '15 at 3:01 am
70
0
az posted Dec 1 '15 at 11:15 pm

I am wondering if this forum can be integrated to my site?

The idea is that I have lots of products and I want to have a forum that lists each product as a thread. Each thread must be 'auto-created' for each product when I add new product in admin. People need to have discussions about each product on site, on the product page, but anytime, when they go to a forum, can continue having conversations on forum as well.
Also, needs to integrate with my back-end user logins.

335
6
tt posted Nov 21 '15 at 1:22 pm

Hi

I found another topic about how someone can show the date also in the chat..
http://codologic.com/forum/index.php?u=/topic/3756/how-to-show-the-chat-date

However I opened the plugins.js file and I cannot find the function you mention.

Also is it possible when sending the conversation from a private chat to show the date/time also. Now it shows nothing.

Thanks in advance.

recent by dm  ·  Nov 28 '15 at 6:33 am
328
10

Hi, I made auto update from admin panel. After update on newest version of Codoforum I´m not able to reach any of topics on forum. Can someone help?

Error: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 't.redirect_to' in 'field list'' in ..... more at screenshot.

5644763757a14.jpg

Thanks for any advice.

recent by UnHynek  ·  Nov 26 '15 at 2:13 pm
113
0

Hi there,
Just wondering whether it is possible to host Codoforum on 000WebHost?
I have been trying to find a forum for my Educational website.
I have tried Muut (not enough free features) and Discourse (can't run on 000webhost) and I now came accross this! If it works, this will definitely be the forum I will go with! It looks great.
Thanks all! smile

344
4
wireframe posted Nov 19 '15 at 11:41 am

i need to integrate freichat application in multiple domains.

for example:

main domain : http://example.com
subdomains : http:one.example.com,http:two.example.com...etc

chatting functionality in main domain between users or guests is working fine, but in subdomains, I am getting a message called "You are banned" i tried to fix it in custom.php and friechat.php.

Please help me anyone.

thanks in advance.

recent by wireframe  ·  Nov 24 '15 at 6:57 am
92
1
Gramlin posted Nov 20 '15 at 10:33 am

Mark-up doens't really allow multiple space indentations (except for &nbsp html).

I would like to know if there is some css I could use to disable the "code block/code" functionality. Or to add some 3,4 or 5 space indentation of my own.

An indent button would be a nice feature.

recent by Gramlin  ·  Nov 21 '15 at 4:10 pm
Categories
Actions
Hide topic messages
Enable infinite scrolling
All posts under this topic will be deleted ?
Previous
Next
With selected deselect topics
Pending draft ... Click to resume editing
Discard draft