Forums / Cotonti / Development / How to safe data from custom field in a user profile to the DB?

foxhound
#41239 2015-12-16 13:16

Wow, thank you very much Macik. That is really some very helpfull info :)
I can pretty much understand where I went wrong and I am going to apply some changes.

I should indeed just have gone for the extra fields, I was just trying to re-invent the wheel I guess :)


Yes, this is still a genoa website, still not gotten to the time to upgrade and figure out what some erros during the upgrade cause (I have tried but failed each time).
Once I have implemented some changes I will post here the results.
I actually plan to share this plugin as it might be usefull to others as well. With this plugin I add a subscription date I add to a users profile which adds the user to a specific group and when the date has passed he is automatically removed from the group. With this you can do all kind of fun stuff....at least I am working on some ;)

Added 1 hour later:

Sigh, I still cant get it to work.

I have created the fields through the extra fields for users. The fields are in my DB, if I change their value (manually directly in the DB) in my profile I can see the changed values.
I have added a file into my plugin for the "users.edit.update.first" hook. In it I added the $-post as you described yet still my DB is not updated when I update my profile with the new info.

I have enabled dbug mode, the "FOOTER_DEVMODE" tags were already present in my footer but I do not see any messages in my footer upon profile update. Does it only display errors if there are any or does it always display something (something in the sense of "dev info")?
So, I would like to share any erros with you, but there are none.

I must be overlooking something really simple, but I simply cant figure it out. :(

Added 2 hours later:

Got it!
Now that I use the user extra fields like you suggested I do not need this hook any more to insert the new field value as that is already done by just the user edit form itself. I was hookibg something which did not need that at all..
I am now only using the hook to get the new date stamp and insert that into the DB upon profile edit submit.

I am sure I will have some more questions but at least now that I can store dates I can work on the plugin funtionality itself :)

<img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />
This post was edited by foxhound (2015-12-16 17:17, 8 years ago)