MyBB Community Forums
An example plugin that shows how to modify registration - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Requests (https://community.mybb.com/forum-65.html)
+---- Thread: An example plugin that shows how to modify registration (/thread-209238.html)



An example plugin that shows how to modify registration - Shigbeard - 2017-03-22

Hi guys. Looking to request an example plugin that will show me how to add questions to the registration and process their results. I want to try and hook into the registration of a new user and automatically register them to a private gameserver, which is what the forum is for. I want their MyBB account to be automatically associated with this account, and I have the registration to the game down solid... I just cannot for the life of me understand how I'm supposed to add fields to the registration page and then get information back from those fields after registration is complete.

In particular I'd like to add a custom username field, as MyBB and the game have different requirements for usernames (the game only permits lowercase usernames up to a certain length etc) but I'd also like to be able to take the user's username and email from registration and put them into the game too. I've looked at the member.php file and got even more confused than when I started. Please send help, or coffee, or both.

Cheers.


RE: An example plugin that shows how to modify registration - fizz - 2017-03-25

Check this out as that's the array that will eventually be inserted into the database with user info, so I'd assume you need to edit that in someway/add elements to it. Haven't actually played with registration much myself but that's where the vanilla registration is handled. As far as displaying the fields your plugin will probably need to hook into register.php somewhere and add its own fields.

Might work on an example if I get some free time in the future, but try checking out other plugins that add custom registration fields, they're a live example of what you want!

Holler if you have more questions