Processing a button in a template with PHP

I'm trying to figure out how to process a button in a XenForo template with custom php code out of my addon script. Please direct me in towards my solution, if at all possible
Last edited:


Well-known member
Its a simple form, you submit to a specific URL (action), and place any PHP you want to run there.

Jake Bunce

XenForo moderator
Staff member
You need to create a route so you have a location to submit the form, then you need a controller for that route to take in the input and write it out to the database. Then create the HTML form that submits to your new route location.

That's the general idea.
I still don't understand how to do this under XenForo. I need to have a simple page, with a simple button, that updates a simple row in the user table.

The idea is that the plugin generates a key and sets the key under a new column in the user table "gen_key".