MyBB Community Forums

Full Version: Insert additional data on registration without profile fields option
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Basically I have setup hidden fields on the member_registration template that get submitted on the POST request to member.php?action=do_register. I want to insert this additional data in the database along with the registration data.

Custom profile fields aren't an option since the fileds are hidden and populated with values in the plugin. But that all works fine, it's not the issue.

There are two hooks available

line 94: $plugins->run_hooks("member_do_register_start");

line 436: $plugins->run_hooks("member_do_register_end");

But the datahandler is used at line 203: $userhandler->set_data($user);

The problem is the $mybb->user array isn't populated with the users registration info until after they leave member.php so there's no way I can do a seperate insert query using the $mybb->user['uid'] var (I vardump'ed $mybb->user to check this, shows 0 [guest] on response)

The other idea I had was an array_push to $userhandler->user_insert_data but this gets overwritten with the registration data after member_do_register_start hook and is already used by the member_do_register_end hook.

I'd rather not have to edit core to do this, but it's looking more and more like the only option right now.

Completely missed the $user_info = $userhandler->insert_user(); on line 383 apparently. Looks like it holds all the info I need.

Okay so it was as simple as a new insert query using $user_info['uid'] for the id... I really need to read things more thoroughly...

Solved by myself