MyBB Community Forums

Full Version: Assigning Custom Profile Fields
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I have a custom profile field, which is displayed on the postbit.
I need to assign one of the selectable options to every member, is there an SQL query to do this?
Is it possible to exclude a UID too?
UPDATE `mybb_userfields` SET `fid(fid number)` = '(option)' WHERE ufid!='(excluded uid)'

BTW this was my 1,000th post.
So I replace (option) with (Class: Unclassed)?
That's the selectable option btw, or is there an ID for options too?
Type the text of the selectable option without ()'s. So if your option is "Class: Unclassed" it would be
UPDATE `mybb_userfields` SET `fid(fid number)` = 'Class: Unclassed' WHERE ufid!='(excluded uid)'
Perfect, thank you.
One more question, how do I assign the default profile field to newly registered members automatically?
Also, how can assign the above profile field to members who do not have it set?
This might work.

ALTER TABLE `mybb_userfields` ALTER COLUMN `fid(fid number)` SET DEFAULT 'default value'
I'll backup and try it.
I added another question to my post as well.
-------
#1101 - BLOB/TEXT column 'fid30' can't have a default value

For those who have none:

UPDATE `mybb_userfields` SET fid30='default value' WHERE fid30=''


For default value, I guess this needs a core file edit, or a plugin that hooks "member_do_register_end". For the file edit:


On member.php, line 297 add:
$db->query("UPDATE `mybb_userfields` SET fid30='default value' WHERE username='".$user_info)['username']."'");

That should work.
First query worked.
Second edit did not, member.php?action=XXX would not load.
Pages: 1 2