I want to create an auto action that saves the uri that the user is on, on every page for all registered users. I have tried various combinations and I can't get it to work.
I have created a code auto action triggered by the joomla_onContentPrepare action that keeps the required code and places it in a variable cb_sitelocation as follows:
$user->set( 'cb_sitelocation', "" );
$pageURL = (isset( $_SERVER ) && $_SERVER == 'on') ? "https://" : "http://";
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
$trim_query_string = false;
if( ! $trim_query_string ) {
$user->set( 'cb_sitelocation', "$pageURL" );
} else {
$url = explode( '?', $pageURL );
$user->set( 'cb_sitelocation', "$url[0]" );
}
I have a CB content module that displays the username on every page to initialize CB and I can see the action executes but the data is either never stored or my data is stored not the users.