XF 2.1 Editing entity changes owner

Matt C.

Well-known member
So in my add-on, editing the entity changes the owner. I just realized I didn't put it any if statements whether or not the entity is being edited. How do I detect if the entity is being edited?

I'm using this:
PHP:
$match->user_id = $visitor->user_id;
$match->username = $visitor->username;

Edit: I found this way, probably not the best way but it works.

Code:
if ($match->isUpdate())
{
}
else
{
    $match->user_id = $visitor->user_id;
    $match->username = $visitor->username;
}
 
Last edited:
Back
Top Bottom