Hope all is well.
We have been using Components Anywhere for several years and love the product. And have had no issues
with it at all until recently when we moved our website to another server.
Here is the situation. We have a module that heftly relies on calling the joomla function $user = JFactory::getUser().
We use this in most of our compnents and use Components Anywhere to placecomponents on the website to control/restrict access to user data.
After days of troubleshooting we were able to narrow it dson to this:
If we call use componets anywhere then we are not able to get the user id/name et cetra when calling $user = JFactory::getUser().
At first we thought it was our code or other components that were flawed. However no matter what component we call, enven builtin Joomla
compnents we get the same problem.
Example: We tested a simple Joomla serach component; index.php?option=com_search&view=search.
If we add the following code to the component in this folder
/components/com_search/search.php . It works well if called
from a menu item and most imoportantly
it works on our other server environment.
$user = JFactory::getUser();
echo 'User name: ' . $user->username . '<br />';
echo 'Real name: ' . $user->name . '<br />';
echo 'User ID : ' . $user->id . '<br />';
User name: John Doe
Real name: John Doe
User ID : 107
Once we use it our new server environment, it works if we call the component directly from a menu item, but does not work if
we place it in a custom module uand use CA as follows:
User ID : 0
Just to recap :
Note 1 :
This applies to any component we try Joomla or otherwise. Actually the code we are using is for another extension but the
problem occurs everywhere. No matter which component. As long as we use CA it cannot retrieve the Joomla user detail.
This is and has been working on our other old decommissioned server without a glitch.
The only changes that we can identify between the 2 servers is that we had to comment out 2 lines in the .htaccess file.
## Can be commented out if causes errors, see notes above.
## Options +FollowSymlinks
## Options -Indexes
Sorry for the long details but we wanted to provide as much detail as possible.
BTW - We are using:
CA version 4.7.2 (we tried 4.7.3 as well )
Joomla version v3.9.4
Both environments mentioned above are EXACTLY the same.