MyBB Community Forums

Full Version: I want to execute a php SQL code when registration is successful
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone. 
I'm new to mybb and for a project of mine I want to execute a php SQL code when the user is successfully registered (the registration was successful). 

I want to insert the password and the username to another database from another host, and I am not sure how to do this and what do edit. 

Can someone help me a little please?
This will require a core edit to the PHP files of MyBB, and will be overwritten on updates so it's not recommended.

There may be a way of doing this with a plugin though. Is the database on the same server?
a plugin can be developed for the required purpose. please see this related reply

some of the available guides for making plugins :
* plugin basics | * database methods | * plugin hooks
* guidance on plugins making
* plugins & hooks explained
* Plugin Authoring For Beginners
* How to make a plugin
* quick tutorial on plugins making
(2018-04-06, 05:33 PM)Cybersec Wrote: [ -> ]This will require a core edit to the PHP files of MyBB, and will be overwritten on updates so it's not recommended.

There may be a way of doing this with a plugin though. Is the database on the same server?


Um... can't I just do something like this:
$one= mysqli_connect('localhost', 'db', 'pass', 'name');

$exec = mysqli_query($one, "INSERT --- statement");

in the "successful register" sequence?
You can edit the php file (member.php) and search for the registration GET section (where php checks if $_GET is set and if it's set to register).

There you should be able to include the file within the function once it is successful.
This isn't recommended if you plan to upgrade your MyBB copy as it will overwrite any core edits you make.