SMF Support > SMF 2.0.x Support
Add New Profile Fields without Custom Profile Fields
Blues Light:
Hello all!
If I wanted to add a new field to my members' profiles, but for the sake of argument I didn't want to do it through the Custom Profile Fields but rather actually edit the php files myself and make it as much a default portion of the profile as Posts, how would I best do this?
I can already add an entry to the SQL database, but I need it to correspond to a profile field.
Any help would be amazing!
Arantor:
I'd really do it via the custom profile fields, seeing how you'd need to make multiple edits in the code in several places (Load.php, Profile-Modify.php, Profile.template.php, possibly Display.template.php if you wanted to show it on threads) and that's before you change the DB schema.
Why don't you want to use the custom profile fields?
Blues Light:
My aim is to have some RPG stats for a portion of my members that want it, so I intended to have, say, an HP field in the profile with a default value of, say, 100. They could purchase an item through SMF Shop to increase that total to, say, 110 or 200 or whatever.
I could do this in the same manner as increasing post count, but connecting it to a custom field has driven be mad for the last week or so, so I surmised that if I could do it with post count, I should be able to add new fields similar to post count, yet only modifiable via those RPG items.
The things I do for my people @.@. If you have any suggestions or would like more information, by all means let me know.
Arantor:
Seriously, set it up with a regular field, visible by regular users, editable by admin. That alone will save you so much work in terms of displaying it.
All you need to do to then update that field is find the relevant row in smf_themes (it'll have the same id_member as the person concerned, its 'variable' will be cust_ followed by the first 8 characters of the field name), and update it.
You won't be able to just update it in a simple update query because the value is held in a text field, but in terms of code change, it's much easier not to mess with all the various pieces of code when you can just keep it solely in your RPG code to update that DB value. (Or in your case a shop item, but you get my point: this way you only have to write a custom shop item as opposed to mulching a lot of code elsewhere that is not designed to be messed with)
Blues Light:
This is probably the dumbest reply I could make, but I don't seem to have the table smf_themes.
I have smf_forumcustom_fields, and that holds the individual fields I've created, but it doesn't appear to hold the data that the fields hold.
I'm missing something aren't I?
Navigation
[0] Message Index
[#] Next page
Go to full version