我正在尝试将演示产品与论坛集成,目前正在注册页面上工作。
当前无法毫无问题地创建新用户,但是我的论坛设置设置为向用户发送带有确认链接的电子邮件,但是外部注册页面不执行此操作,它只是添加了他们。
我已经进行了广泛的搜索,但是找不到关于该主题的任何过时信息。
目前,我有-(这只是一个粗糙的代码,我打算在成功完成注册后发送电子邮件确认的功能目标后整理一下)
define('IN_PHPBB', true);
global $db;
global $config;
global $user;
global $auth;
global $cache;
global $template;
global $phpbb_root_path;
global $phpEx;
global $phpbb_container;
global $phpbb_root_path, $phpEx, $user, $auth, $cache, $db, $config, $template, $table_prefix;
global $request;
global $phpbb_dispatcher;
global $symfony_request;
global $phpbb_filesystem;
$phpbb_root_path = '../forum/'; // forum directory path here
$phpEx = 'php';
//include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path.'common.php');
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
require($phpbb_root_path .'includes/functions_user.php');
$user_actkey = md5(rand(0, 100) . time());
$user_actkey = substr($user_actkey, 0, rand(6, 10));
$username = 'MyUserName111';
$password = 'MyPassword11'; // Dont encrypt the password!
$email = 'email@test.com';
$request->enable_super_globals();
$user_row = array(
'username' => $username,
'user_password' => md5($password),
'user_email' => $email,
'group_id' => 7, #Registered users group
'user_timezone' => 'UTC',
'user_lang' => 'en',
'user_type' => '1',
'user_ip' => $_SERVER['REMOTE_ADDR'],
'user_actkey' => $user_actkey,
'user_dateformat' => 'D M d, Y g:i a',
'user_style' => 2,
'user_colour' => 'BFBFFF',
'user_inactive_reason' => 1,
'user_regdate' => time(),
'user_new' => 1,
'user_eth_address' => "0x0"
);
$request->disable_super_globals();
$phpbb_user_id = user_add($user_row);