NUM error

3 posts by 3 authors in: Forums > CMS Builder
Last Post: August 12, 2010   (RSS)

Re: [s2smedia] NUM error

By Jason - August 12, 2010

Hi,

The best solution would be to restore a backup from before you made the change. This will rename the field back to "num". It will still have the new column name when you view the section editor, so go to data/schema/ folder and find the accounts.ini.php. The file will look something like this:

;<?php die('This is not a program file.'); exit; ?>

_disableView = 1
listPageFields = "fullname, username, email, isAdmin"
listPageOrder = "fullname, username"
listPageSearchFields = "fullname, username, email"
menuHidden = 0
menuName = "User Accounts"
menuOrder = 1191281761
menuType = "multi"
tableHidden = 0

[NEW FIELD NAME]
order = 1
isSystemField = 1

[createdDate]
order = 2
type = "none"
label = "Created"
isSystemField = 1


Where NEW FIELD NAME is the name you changed num to. Change this back to num and save the file.

That should take care of the issue. It would also be a good idea to disable system field editing from the advanced options menu of your section editor. This will help avoid this mistake in the future.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] NUM error

By Chris - August 12, 2010

Oh wow, we really shouldn't allow people to do that!

I tried this out to see if I could recover from it and it's not looking pretty. Rather than renaming the num field, it was dropped entirely. If you don't have a backup, your CreatedByUserNum and UpdatedByUserNum fields in your other tables are likely going to be corrupt.

I modified my accounts.ini.php as Jason recommended above, but I also had to run an SQL query to add my num field back, since I was trying to recover without using a backup:

ALTER TABLE cms_accounts ADD COLUMN `num` int(10) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT;

This resulted in all my user accounts being assigned fresh nums. Depending on how you've set up your CMS Builder tables, (specifically, whether you're relying on account nums for anything,) this could either be devastating or of no concern at all!
All the best,
Chris