Account Edit Clearing Database

jonimpson

New Member
Is there a way to have it "update" the database rather than rewriting the whole site? I have some custom fields in the database that get wiped whenever you edit your account.

**EDIT**
After some further investigation it is deleting from the database any field that is created but not filled out/available to the user. As in I have several fields that I use in the database that the user doesn't necessarily need to edit but I needed them to include some data recorded elsewhere and as such are hidden to the user but visible in the admin panel.

Editing the user from the admin area because all fields are shown does not delete the data, so this appears to be a huge bug :)
 
Last edited:

Mark

Administrator
Staff member
I don't follow, can you post exact steps to reproduce this issue please? The whole site is never cleared and re-written, that is not even possible.
 

jonimpson

New Member
Create a custom join field but do not add it to the template so the user cannot see/edit it, go into the database manually and change the value, then go and edit your site and it will clear what you entered into the database.

I have a script that runs and manually fills in those fields in the database but the user never needs to see or edit them, I did want them visible to the admins however which is why I created the fields.

I had someone look over the edit code as I know nothing about coding and he said that if the user cannot edit the field it automatically sends a null value to the database which I believe is what is clearing those values.


As a workaround I used java to load all the fields and make them hidden and uneditable until it gets sorted, not the best solution since the data entered is wrong and the script has to run again to update the data correctly but at least it's not clearing it out.
 

Mark

Administrator
Staff member
Create a custom join field but do not add it to the template so the user cannot see/edit it, go into the database manually and change the value, then go and edit your site and it will clear what you entered into the database.
Indeed, this is not really how that function was designed to work. You should probably make your own database field for your custom script that is inserting the data OR you should add join field the edit form and simply make it hidden so the correct value you custom inserted is passed behind the scene, the user will never see it. Instead you are passing an empty value which is then clearing out the record that you manually inserted.

Really, I think simply adding the field to the edit form and hiding it with CSS is the easiest way to solve this (no JavaScript necessary). You just populate it with whatever is currently in the database (which should happen automatically anyway as that is how it was designed to work in the first place)
 

jonimpson

New Member
Yeah I tend to find ways to break things haha, but yes that's essentially what I am doing. The only reason I chose to do it this way was because everything needed is already in place, I'm not really a coder so the script I have I was able to get working because it was easy enough to comprehend what it was doing after reading it a million times. For me to pull the stuff from the database and display it where I need to is something I wouldn't know how to accomplish at this time.
 
Top