Deleting users in Joomla

  • Posts: 292
  • Thank you received: 5
  • Hikashop Business
13 years 9 months ago #9093

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.

Please Log in or Create an account to join the conversation.

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
13 years 9 months ago #9105

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...

Please Log in or Create an account to join the conversation.

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
13 years 9 months ago #9112

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.

Please Log in or Create an account to join the conversation.

  • Posts: 292
  • Thank you received: 5
  • Hikashop Business
13 years 9 months ago #9146

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.

$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.

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
13 years 9 months ago #9156

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.

Please Log in or Create an account to join the conversation.

Time to create page: 0.057 seconds
Powered by Kunena Forum