MyBB Community Forums

Full Version: Registration Variable?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to pass a variable into the registration page.
I'd like to have something like
member.php?action=register&username=sethgandy

Is this at all possible?
(2015-02-05, 07:42 AM)Sethgandy Wrote: [ -> ]I'm trying to pass a variable into the registration page.

From where to what?

Generally you can pass variables through hidden input in the template form, the variable can then be used in the called PHP module defined in the form tag after a submit butten has been clicked, by mybb->input['variable_name'] and is set in the template form by :

<input type="hidden" name="variable_name" value="assigned_value_to_variable" />
Here's the full details of what I need.
Previously, I had written a minecraft plugin that would generate the user a link to click on that would take them to the registration page. It would contain their minecraft username in the link and prefill the username field so they could not edit it, as it is case specific (something written into other minecraft plugins that I am unable to change).

Previous registration system:
http://sethcraft.com/register.php?username=SeThGAndy

I'm trying to use the forum as the new registration method and database to pull from when linking a player's info to minecraft (I have a forum->minecraft bridge plugin).

So I need to be able to generate a static link as the one above that passes the username variable into the registration page, that doesn't enable modifying of the field when the username is passed in.
First in template member_register, set the input field for the username to:

<input type="text" class="textbox" name="username" id="username" style="width: 100%" value="{$mybb->input['username']}" disabled />

Then, try whether this will work in the form before the </form> tag:

<input type="hidden" name="username" value="{$mybb->input['username']}" />

I cannot test this now, but this would be my first try.
Alright, I've made the modifications to the member_register template (from {$username} to the listed field + hidden tag next to the other hidden tags), but it still seems to clear out the username variable when I accept the terms page.

http://sethcraft.com/forum/member.php?ac...=sethGandy
And when you add the same hidden input line to template member_register_agreement?
... You sir, are a wizard!
Thank you so very VERY much!
You've made my day! And it's not even 7am!