Arrowchat/cruge With Yii

Hello fellas, i’ve been trying to make this thing work, sadly my skills in programming are severely lacking. I’ve got Crudge installed, well and working. It’s a user management module. Also i’ve been trying this “Arrowchat” thing to work on Localhost, and it does, it just wont work with existing users from Crudge database. It requiered table of Crudge_user where i did indicate each camp it asked for, but in the end while using localhost/site/arrowchat/debug it shows me that my ID isn’t working at all. Yet Crudge login and users are ok.Arrowchat got this function i need to configure :

function get_user_id() 

{

$userid = NULL;





if (!empty($_SESSION['userid']))


{


	$userid = $_SESSION['userid'];


}





return $userid;

}

I understand this isn’t telling you anything , however , maybe some of you guys been trying arrowchat on custom site as well, and made this thing work . I would aprecite any minor tip or advice and/or any direction i should search for the solution. Thanks a lot.

Edit : Any tips ? i found that Yii got this simple function

$id = Yii::app()->user->id;

which successfully delivered me userid, yet since arrowchat folder needs to be out of Yii folder, it does not understand the Yii functions. Maybe is there a way to include them somehow to arrowchat ?

Bumping the post, maybe someone will notices it!

What you’re really asking is how you can use Yii’s authentication and session mechanism from a non-Yii application.

Sadly, this is something I couldn’t figure out when I needed it. I had to install the file upload extension in TinyMCE and I ended up using a separate user name and password because I couldn’t figure out how to use the main application’s user session (CDbHttpSession).

I’d still be interested to know how this should be handled. I can’t imagine that creating a throwaway web application instance is the right approach.

EDIT:

Okay, I have managed to get it working using a throwaway web application instance. My Yiifoo has clearly improved since I initially tried.

You can create a web application like this:




    $yii = 'your/path/to/yii';

    $config = 'your/path/to/config';

    require_once($yii);

    Yii::createWebApplication($config);


    $userId = Yii::app()->user->id;



Have a look at your main Yii index file to see how the paths should are normally specified. For this, they’ll need to be relative to the file that’s being executed.

Note that the run() method of the application object is not called.