1

I have deleted users from Liferay UI. Some time its asking to deactivate and then delete. some time only deactivate. And users are not going from db always. So, recreation of same user is not possible as it is throwing errors like "email address already exist or username alreasdy exist".

Why user is not getting deleted from DB after deletion from UI?

I am using liferay-portal-6.1.1-ce-ga2.

How to solve this issue?

Aneesh
  • 153
  • 4
  • 16

3 Answers3

12

Deactivate and Delete are two different functionalities.

When you Deactivate the user remains in the database and only the status is changed to deactivate. This is known as a soft-delete or logical-delete, i.e. the User deactivated will not be able to login, nor will he appear in any of the searches etc. But the advantage is that you can bring the User back to life by just Activate-ing the User. So this does not require you to re-create the User and also helps in keeping history or actions on the User.

If you want to delete the User from database, go to Control PanelUsers & Organizations → click on Search All Users → Search for the user either by Advanced or Basic Search → select the User(s) → Click Deactivate.

After this, do an Advanced Search → Select the status as Inactive → You will find all the de-activated users → select them and click Delete.

Hope this helps.


Edit

(thanks to @hudolejev for pointing this out in the comments below)

Please also note that the following property is set to true to delete users in portal-ext.properties, by default it is true:

#
# Set this to false if users cannot be deleted.
#
users.delete=true
Community
  • 1
  • 1
Prakash K
  • 11,537
  • 5
  • 49
  • 107
  • Yes, the advanced search of inactive users allowed to delete user completely. – Aneesh Sep 26 '13 at 11:17
  • Can u pls tell me the parameter using for displaying usesr name in email notification template? – Aneesh Sep 26 '13 at 11:18
  • If you have liferay source code, search for all `*.tmpl` files, those are the email templates files. So you can search for the email template for the particular module you want, like for blogs, messageboards, wiki, membership etc. You may want to see this [blog post](http://www.apoorvaprakash.in/2010/11/modifying-e-mail-notification.html) a bit old but gets the message across. – Prakash K Sep 26 '13 at 12:28
  • May I know the email template used while sending mails when doing user creation by consuming jsonws please? – Aneesh Sep 26 '13 at 12:51
  • 1
    Note that `users.delete` should be set to `true` in `portal-ext.properties`, otherwise this 'Delete' action will not appear. – hudolejev May 10 '15 at 10:09
2

Manual delete:

If you want to delete from the DB directly make sure you remove all records related to the user on the next tables:

DELETE FROM Users_UserGroups WHERE userId = 'userid';
DELETE FROM Users_Roles WHERE userId = 'userid';
DELETE FROM Users_Orgs WHERE userId = 'userid';
DELETE FROM Contact_ WHERE userId = 'userid';
DELETE FROM Group_ WHERE classPK = 'userid';
DELETE FROM User_ WHERE userId = 'userid';
Israelm
  • 1,442
  • 2
  • 18
  • 26
0

When you just dectivate the User it still exists in the Liferay DB,So after each deactivation go and try to find the deactivated user and then delete it.

If you dont find user after deactivation, try to go to the Server administration and Reindex all search indexes. and then try again.

Regards Manish