AjaxChat Integration with UserCake

Luigi
2012-06-29
2012-11-15
  • Luigi

    Luigi - 2012-06-29

    Please find below instructions on how to integrate AjaxChat in UserCake
    (usercake.com: "it's one of the simplest and most secure user management systems on the internet.").

    Assuming that Usercake is installed in the root directory of your site and AjaxChat is in the "/chat" subdir:

    1- Modify the file
           lib/custom.php (you need to add the php file for the login)

    require_once("../models/config.php");

    //Eventually Prevent the user visiting the logged in page if he/she is not logged in, comment the following if you don't need it

    if(!isUserLoggedIn()) { header("Location: ../login.php"); die(); }

    2- Modify the file
           lib/class/CustomAJAXChat.php (for login method)

    function getValidLoginUserData() {

            global $loggedInUser;

            // Check if we have a valid registered user:

            /*customisation for UserCake Version: 1.4

    http://usercake.com

    assuming that chat directory is inside the userCake setup directory

    */

            if(isUserLoggedIn()) {

                $userData = array();

                $userData = $loggedInUser->user_id;

                $userData = $this->trimUserName($loggedInUser->display_username);

                if($loggedInUser->group_id==2)

                    $userData = AJAX_CHAT_ADMIN;

                elseif($loggedInUser->group_id==3) //this must be added to userCake groups

                    $userData = AJAX_CHAT_MODERATOR;

                else

                    $userData = AJAX_CHAT_USER;

    return $userData;

            return null;

          } else {

    // Guest users:

    return $this->getGuestUser();

    }

    }

     
  • Philip Nicolcev

    Philip Nicolcev - 2012-07-03

    Thank you for sharing!

     
  • Luigi

    Luigi - 2012-07-05

    My pleasure. I hope it will be useful to someone (For sure it will be useful for me when I'll forget how to do that :-P  )

     
  • Luigi

    Luigi - 2012-07-05
     
  • sync667

    sync667 - 2012-08-23

    You now how to do it without usercake but only cakephp auth system ?

     
  • Luigi

    Luigi - 2012-08-24

    No, sorry, I'm not familiar with cakephp :-(

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks