Question

I need to access the user id in my custom php script which resides inside the public folder of activecollab.

I am not inside a controller,model or view. i'm outside the framework otherwise i could apply this solution: fetching logged in user data in activecollab by $this->logged_user

Thanks.

Was it helpful?

Solution

If you are not building a module (which is recommended way to extend the system), than best approach that you can take is to:

  1. Read activeCollab's session ID that's stored in a cookie (HTTP only, not available to JavaScript). Variable name is different from system to system and all start with ac_activeCollab_sid_#UNIQUE-VALUE# so you should check stored values for a system where you are already logged in to see which exact variable you should look at.
  2. Once you get session key from a cookie, query acx_user_sessions table using that key to see if session exists and who is logged in. Key format is: #USER-ID#/#SESSION-ID#/#TIMESTAMP# so explode the value to get the bits that you need.

Note that we do not recommend that you do external transformation of the data that's in the database. Read it, but don't write anything - leave that to activeCollab or implement desired functionality as a module (link provided above).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top