Deleted Admin Account by mistake

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
I'm using version NOP Commerce v1.80 and SQL Server 2008, I recently deleted my admin account and all new registrants had to be approved by the administrator. So therefore I can't use the SQL UPDATE command to change "IsAdmin" to 1. Beacuse this is a new store, the Admin was the only customer. Does anyone know how I can reestablish the admin account? Thanks in Advance.
13 years ago
Execute the following command over your database (it's for nopCommerce 1.80):
INSERT [dbo].[Nop_Customer] ([CustomerGUID], [Email], [Username], [PasswordHash], [SaltKey], [AffiliateID], [BillingAddressID], [ShippingAddressID], [LastPaymentMethodID], [LastAppliedCouponCode], [GiftCardCouponCodes], [CheckoutAttributes], [LanguageID], [CurrencyID], [TaxDisplayTypeID], [IsTaxExempt], [IsAdmin], [IsGuest], [IsForumModerator], [TotalForumPosts], [Signature], [AdminComment], [Active], [Deleted], [RegistrationDate], [TimeZoneID], [AvatarID], [DateOfBirth]) VALUES (N'18c4f7dc-2964-41db-9611-8a313bf672d3', N'[email protected]', N'[email protected]', N'14F009DDBEF203EDC2124D54FA6D325E16E36D77', N'vw7zHZI=', 0, 78, 77, 0, N'', N'', N'', 7, 1, 1, 0, 1, 0, 1, 0, N'', N'', 1, 0, CAST(0x00009B3600C2192F AS DateTime), N'', 0, CAST(0x0000769B00000000 AS DateTime))
13 years ago
Thank you for your quick response earlier.

I executed the command over my database and received the following error.

Msg 207, Level 16, State 1, Line 1
Invalid column name 'DateOfBirth'.

I added the DateOfBirth column to the database, the query executed successfully, but I'm still not able to log in using the default login credetials([email protected], pswd: admin). Am I doing something wrong? Thanks in Advance.
13 years ago
I added the DateOfBirth column to the database, the query executed successfully, but I'm still not able to log in using the default login creditials([email protected], pswd: admin). Am I doing something wrong? Thanks in Advance.
13 years ago
Create a new account through the normal registration process. Then run this script:

UPDATE Nop_Customer SET IsAdmin = 1 WHERE (Email = '[email protected]')

Then login.
13 years ago
When I register a new account. It says that the account will be approved by the administrator. So after trying to run the command, I'm still not able to log in after setting IsAdmin to 1. Is there another way?
13 years ago
Ok. I think I know what the problem is. Since your website is configured to only allow new users to register upon verification from the admin, try running this script after you create a new user through the normal registration process:

UPDATE Nop_Customer SET IsAdmin = 1, Active = 1, RegistrationDate = GETDATE() WHERE (Email = '[email protected]')
13 years ago
Thank you for your response--I tried creating a new registrant account and then tried running the command over the database by doing a new query with the command you suggested: UPDATE Nop_Customer SET IsAdmin = 1, Active = 1, RegistrationDate = GETDATE() WHERE (Email = '[email protected]')
The command doesn't seem to find the new email address of the new registrant, may be because it hasn't been approved by the administrator? Any other thoughts? Thanks in Advance.
13 years ago
sorry to ask the obvious, but are you replacing  '[email protected]' with the e-mail of the new user you created ?  eg [email protected]

if you are able to view the database table

nop_customer

you can directly edit the row of your users - eg find the 'deleted' admin@yourstore (its still in the database)

and look for the column 'Deleted'

change this to 'false'
13 years ago
Thanks again for your response. Yes, I am changing the email address([email protected]) to the new registrant email address. I also checked the database and saw that [email protected] is there and the deleted column is already set to false. I don't see any of the new registrants that I created in the nop_customer table. Any other suggestions would be much appreciated.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.