How to modify $visitor instance in visitor_setup?

tyteen4a03

Well-known member
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?
 

xf_phantom

Well-known member
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

xf_phantom

Well-known member
$visitor->_user won't work because $_user is protected



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

should work too
 
Top