Solved: 3 Years, 9 Months, 3 Weeks ago Custom field in registration
#1
Solved: 3 Years, 9 Months, 3 Weeks ago
Good evening,

I'm having quite the time trying to figure this one out.
They current method I have setup for registration is having the username variable passed in through the URL.
It auto populates in the username field, all good.

Now, I'm trying to create another field, a custom field to pass into into the registration for via URL.
Problem is, there's not really a variable associated with the easy ACP 'add custom field' option, so I can't tie that data to a field (fid9).
Since there's not an id linked to it, I can't populate it with URL data.

When I try and code in a field, it works, I can pass info into it, but it won't push into the MySql db.
When I edit user.php to accommodate the extra data, it goes through without error, but doesn't actually submit the data into the database...

Any ideas?
Reply
#2
Solved: 3 Years, 9 Months, 3 Weeks ago
Ok, since nobody lent a hand, I've found my own answer after 3 days of hundreds of minor changes and attempts...

So, in the member_registration_agreement template I added:
<input type="hidden" name="uuid" value="{$mybb->input['uuid']}" />
Before the </form> tag.

Then I added a field in the member_register template:
<td colspan="2"><input type="text" class="textbox" name="uuid" id="uuid" style="width: 100%" value="{$mybb->input['uuid']}" readonly/></td>

NOTE the readonly, disabled will not work for the form submission process, it will pass a blank variable.
It is read only so it can't be fiddled with, it can only use the data passed in through the URL.

Next, I edited inc/datahandlers/user.php. I found:
"usernotes" => ','

And added on the next line:
"uuid" => $db->escape_string($user['uuid'])

Then I edited /member.php, added:
"uuid" => $mybb->get_input('uuid'),

after line:
"regcheck2" => $mybb->get_input('regcheck2'),

Lastly, I edited the MyPhpAdmin database, under mybb_users and added a field called 'uuid' to the structure.

There you go, if anyone needs to add a custom line in the registration that needs data passed in, I've saved you a mental breakdown! Big Grin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)