Custom profile fields SQL modification help?
#1
I hope this post is in the right location. I am developing a mod for my forum which is based on the default custom profile field. I am a hobbyist, so please excuse my inexperience.

Original Custom Profile Field does this:
Admin CP -> Add new profile field
Goes to db as mybb_profilefields with fid, name, description, order, etc.
User CP -> Custom field is filled out
Goes to db as mybb_userfields with ufid (uid) and the input from fid(n), etc.

My mod is for an RPG where users have multiple characters. I've basically copied the custom profile field bits and made them for custom CHARACTER profile fields, such that:
Admin CP -> Add new custom character field
Goes to mybb_characterfields as cfid, name, desc, etc.
UserCP -> Fill it out... (this is where I am stuck)
SHOULD go to mybb_characters with cid, ucid, and input from each cfid.

Now, this table, characters, works fine just like the userfields table, where one userID answers each of the custom FIDs. But, I want people to have multiple characters such that one uid can have (n) number of cids attached to them, but each cid is filled out with the same cfids.

CID (index?)| UID (foreign key?)| CFID1 (name)|CFID2 (gender)
1 2 Bob M
2 5 Joe M
3 2 Sally F
4 1 Brett M
5 2 Terrence M

I will also need to figure out how to separate these into different userCP pages (edit character 1, add another character, etc.) and have them be restricted based on post number or some other field. But I assume that is PHP for later.

I am pretty crap with foreign keys, indexes, etc. hence the confusion. Any advice with how to design and implement such a table would be greatly appreciated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)