How to modify $visitor instance in visitor_setup?

tyteen4a03

Well-known member
Licensed customer
I want to do something to $visitor->_user in visitor_setup, however, I'm getting Indirect modification of overloaded property has no effect errors.

How do I properly do this?
 
You should post your full visitor_setup code.

To reproduce the error just do anything to the $visitor object.

If you're asking for the actual function it should do, I have none - I’m just asking if this is possible.
 
it's working for me

PHP:
public static function injectIgnoredUsers(XenForo_Visitor &$visitor){
$visitor['my_new_foo'] = 'we\'re here';
$visitor['ignoredUsers'] = self::getIgnoredUsers();
}
 
  • Like
Reactions: Sim
it's working for me

PHP:
public static function injectIgnoredUsers(XenForo_Visitor &$visitor){
$visitor['my_new_foo'] = 'we\'re here';
$visitor['ignoredUsers'] = self::getIgnoredUsers();
}

Oh! I was modifying $visitor->_user. My bad :P
 
  • Like
Reactions: Sim
$visitor->_user won't work because $_user is protected



$visitor->offsetSet('name', 'value');

should work too
 
Back
Top Bottom