0 Replies Latest reply on Aug 12, 2011 8:47 AM by Jason Woodcock

    Accessing Joomla User Id Inside Flex 4.5

    Jason Woodcock Level 1

      Alright, I posted this over at the Joomla forums as well and figured I'd try here as well... Here's my delima:



      I have a flex 4.5 app that I am trying to utilize on a joomla page and I need it to access the currently logged in user id.


      So, here is what I have so far:


      My PHP class:




      class userId {
            public function getuserID($userID) {
               //Defining Joomla path, variable, and determining user id
               define( '_JEXEC', 1 );
               define('JPATH_BASE', dirname(__FILE__) );
               define( 'DS', DIRECTORY_SEPARATOR );
               require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
               require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
               $mainframe =& JFactory::getApplication('site');
               $userID = & JFactory::getUser();;
               return $userID;






      My protected function in Flash Builder CS5:


      protected function username_creationCompleteHandler(event:FlexEvent):void




                              getuserIDResult.token = userId.getuserID($userId);




      And for testing purposes, I just want to display it in a text label:


      <s:Label id="username" width="60"


      Now, I have the release build in an article in Joomla. But when the page loads, I get the following error in the Flex app:


      Channel disconnected
      Channel disconnected before an acknowledgement was received


      Now, I am pretty sure I have double checked my source code in flex through and through. So I don't think the problem is there (I may be wrong though...). And if I comment all the code out inside the PHP function and declare the userid variable to any static string it returns that string perfectly in the flex app. So my feeling is it is in the PHP class...


      Anyone here see where I am going wrong?