Deleting users in Joomla
- brainforge
-
Topic Author
- Offline
Less
More
15 years 7 months ago #9093
by brainforge
Deleting users in Joomla was created by brainforge
I seem to recall something about this elsewhere, but could not find it.
Registered 2 users in registration screen (cart empty, neither purchased anything).
Deleted both users in Joomla User admin.
Row deleted from Hikasop users table but not from the address table.
Tried again this time deleting through Hikashop customers - again records in address table not deleted.
Registered 2 users in registration screen (cart empty, neither purchased anything).
Deleted both users in Joomla User admin.
Row deleted from Hikasop users table but not from the address table.
Tried again this time deleting through Hikashop customers - again records in address table not deleted.
Please Log in or Create an account to join the conversation.
15 years 7 months ago #9105
by nicolas
Replied by nicolas on topic Re: Deleting users in Joomla
It's possible that there is a piece of code missing in order to handle that. No one reported it so far since it doesn't create any bug on the interface.
We'll look at that...
We'll look at that...
Please Log in or Create an account to join the conversation.
15 years 7 months ago #9112
by nicolas
Replied by nicolas on topic Re: Deleting users in Joomla
If you edit the file adminsitrator/components/com_hikashop/classes/user.php and add the code:
if($result){
$address = hikashop::get('class.address');
$addresses = $address->loadUserAddresses($el);
$address->delete(array_keys($addresses));
}
after the line:
$result = parent::delete($el);
that should solve the problem.
if($result){
$address = hikashop::get('class.address');
$addresses = $address->loadUserAddresses($el);
$address->delete(array_keys($addresses));
}
after the line:
$result = parent::delete($el);
that should solve the problem.
Please Log in or Create an account to join the conversation.
- brainforge
-
Topic Author
- Offline
15 years 7 months ago #9146
by brainforge
Replied by brainforge on topic Re: Deleting users in Joomla
Almost worked, wrong parameter passed to address->delete().
Also added another message - testing Hikashop with other components which output their own "user has been deleted messages", so looks better having a Hikashop message as well.
Would it be possible to add a configuration option so that when selected deleting a customer via the customer screen will also delete the Joomla user? Need to be careful here that someone does not accidently delete an administrator / super administrator account - I think there was another post about prevent certain users being Hikashop customers - I have been registering test users but someone else went in as themselves (administrator) and tested order creation - something I would like to see prevented.
Also added another message - testing Hikashop with other components which output their own "user has been deleted messages", so looks better having a Hikashop message as well.
Code:
$result = parent::delete($el);
if($result){
$address = hikashop::get('class.address');
$addresses = $address->loadUserAddresses($el);
foreach ($addresses as $a) {
$address->delete($a->address_id);
}
$app =& JFactory::getApplication();
$app->enqueueMessage('User deleted from Hikashop.');
}
Would it be possible to add a configuration option so that when selected deleting a customer via the customer screen will also delete the Joomla user? Need to be careful here that someone does not accidently delete an administrator / super administrator account - I think there was another post about prevent certain users being Hikashop customers - I have been registering test users but someone else went in as themselves (administrator) and tested order creation - something I would like to see prevented.
Please Log in or Create an account to join the conversation.
15 years 7 months ago #9156
by nicolas
Replied by nicolas on topic Re: Deleting users in Joomla
Indeed, the parameter should be an int and not the array of ids. We corrected on our end. We won't add the specific message. It should be enough to just have the main message. We want to try to keep the language file as small as possible. ( it's already more than 1000 lines )
Besides, there is already a message displayed when you delete a user in hikashop so you would have to add a check to display only the message when not in hikashop.
For the deletion of the joomla user when deleting a customer in HikaShop, we'll add that to the todo list but as a low priority... There are already loads of options in HikaShop and users already get lost in them so adding one more just for that doesn't feel like a plus.
Besides, there is already a message displayed when you delete a user in hikashop so you would have to add a check to display only the message when not in hikashop.
For the deletion of the joomla user when deleting a customer in HikaShop, we'll add that to the todo list but as a low priority... There are already loads of options in HikaShop and users already get lost in them so adding one more just for that doesn't feel like a plus.
Please Log in or Create an account to join the conversation.
Time to create page: 0.202 seconds