I have installed PHPBB 3.3.14 and I want to add a user from my own register form to PHPBB.
I found out that it can be done with the following code:
Code: Select all
define('IN_PHPBB', true);
// Specify the path to you phpBB3 installation directory.
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '/home/xxx/domains/yyy.nl/public_html/forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
// The common.php file is required.
include($phpbb_root_path . 'common.' . $phpEx);
mail('[email protected]', '1', '1');
require($phpbb_root_path . 'includes/functions_user.' . $phpEx);
mail('[email protected]', '2', '2');
$username = "Test";
$user_password = "123456";
$user_email = "[email protected]";
$group_id = 2;
// $user_type = USER_NORMAL;
$user_type = 0;
$user_ip = $_SERVER['REMOTE_ADDR'];
$registration_time = time();
mail('[email protected]', '3', '3');
$user_row = array(
'username' => $username,
'user_password' => phpbb_hash($user_password),
'user_email' => $user_email,
'group_id' => $group_id,
'user_type' => $user_type,
'user_ip' => $user_ip,
'user_regdate' => $registration_time
);
mail('[email protected]', '4', '4');
// Register user...
$user_id = user_add($user_row, false, null);
I only get email 1 and 2 in my mailbox as a test where the code breaks so what is wrong with the setting of the variables?
I can't figure it out, it should be a very stupid thing ..........
Kind regards,
Arie