mcatze
Well-known member
Hi everybody,
for my membermap addon i want to create to options for the batch update users function. It should just clear two fields in the xf_user_profile table.
Can someone give me a hint how to extend the UserAction class for two new actions?
I've tried this at the moment.
for my membermap addon i want to create to options for the batch update users function. It should just clear two fields in the xf_user_profile table.
Can someone give me a hint how to extend the UserAction class for two new actions?
I've tried this at the moment.
PHP:
protected function applyInternalUserChange(\XF\Entity\User $user)
{
/** @var \XF\Entity\UserProfile $profile */
$profile = $user->getRelationOrDefault('Profile', false);
if ($this->getActionValue('xt_mm_empty_location'))
{
$profile->location = '';
$user->addCascadedSave($profile);
}
if ($this->getActionValue('xt_mm_hiding_from_map'))
{
$profile->xt_mm_show_on_map = '0';
$user->addCascadedSave($profile);
}
return parent::applyInternalUserChange(\XF\Entity\User $user);
}