MyBB Community Forums

Full Version: registration MySQL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When a user registers on my MyBulletinBoard, and their information supplied was valid (so they were added to the database successfully), I want the script to run another query. This query would use their registered username and password and insert it into another database table. Basically, I want to customise MyBB so that a user can register at both the board and a separate script at the same time through the MyBB registration.

(Note: This is being used to bridge MyBB with Coppermine Photo Gallery manually, since their bridge software doesn't do what I want it to do. This way, they will register and can then upload their graphics to Coppermine.)

Normally, I would do this myself, but I find MyBB's PHP very complicated. It confuses me, since there's no HTML to back me up. Too many variables.

So, if you could just supply me with some code and where to put it, I would be extremely grateful.
Look at integration.php
Where is this file?
I'm assuming you're talking about integrating the two applications. That is not what I want. I want to insert code for doing an additional registration query.
Integration.php (or also known as intergration.php) has been previously removed from MyBB in favour of the plugin system.

You can simply make a plugin like this:
<?php
function coppermine_info()
{
	return array(
		"name"			=> "Coppermine Integration",
		"description"	=> "Registrations copied to coppermine",
		"website"		=> "",
		"author"		=> "",
		"authorsite"	=> "",
		"version"		=> "A",
	);
}

$plugins->add_hook("member_do_register_end", "coppermine_run");
function coppermine_run()
{
	global $mybb, $user_info, $db;
	/*
	You can use $user_info['uid'], $user_info['username'], $user_info['email'], $user_info['usergroup'].  
	The plain text password can be accessed with: $mybb->input['password'].  
	For any other user-settings, you will have to query the MyBB database to grab the user information.  
	You can then create the user for Coppermine.
	*/

	// your code here

}
?>

Copy this code, modify it to add the query to Coppermine and save it as coppermine.php (important). Upload it to your inc/plugins folder and activate.