Strict Standards - Only variables should be assigned by ref

hannylicious 20 Mar, 2013
Only variables should be assigned by reference is the Strict Standards error I get.

It has to do with me calling up the current user information in Joomla so I can log which user is submitting the forms.

I do so by putting this custom code into the onLoad:
<?php
$user =& JFactory::getUser();
$form->data['agentnumber'] = $user->username;
$form->data['agentname'] = $user->name;
?>


Then I put the value of 2 hidden fields as {agentnumber} and {agentname} respectively.

When I go to the form it gives me:

Strict Standards: Only variables should be assigned by reference in **localsiteinfo**\administrator\components\com_chronoforms\form_actions\custom_code\custom_code.php(19) : eval()'d code on line 2

hannylicious 20 Mar, 2013
Resolved:

Changed my code to be:
<?php
$user = JFactory::getUser();
$form->data['agentnumber'] = $user->username;
$form->data['agentname'] = $user->name;
?>


By deleting the '&' it fixed the issue!
GreyHead 21 Mar, 2013
Hi Hannylicious,

I'd strongly suggest that you turn Strict Standards reporting off. Please see this FAQ

Bob
This topic is locked and no more replies can be posted.