PHPBB3 External registration - getting email confirmation

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
IsaacBosher
Registered User
Posts: 1
Joined: Wed Feb 20, 2019 10:21 pm

PHPBB3 External registration - getting email confirmation

Post by IsaacBosher »

I'm trying to integrate my demo product with my forums, and currently I am working on a registration page.

Currently I'm able to create new users with no problem, but my forum settings are set to send an email to the user with a confirmation link, however, the external registration page does not do this, it just adds them.

I have done extensive searching and haven't been able to find any information on the topic that isn't outdated.

Currently, I have - (This is just a rough code I intend to tidy up once I've completed the functionality aim of an email confirmation being sent upon successful signup)


** UPDATE - I have since made progress in calling the function, this calls the function but doesn't output any errors or send the emaIl. I know it's calling the function because I enter the wrong template name it will error saying it can't find the template. - The code below is updated

Any help will be greatly appreciated, I've been trying to solve this for a good week!


I've found: https://wiki.phpbb.com/Sending_e-mails - however, i still can't seem to call the function

Code: Select all

<?php
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 = 'MyUserName11111';
$password = 'MyPassword1111'; // Dont encrypt the password!
$email = '[email protected]';
$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_inactive_time' => 1549890587,
'user_regdate' => time(),
'user_new' => 1,
'user_eth_address' => "0x0"
	
);
$request->disable_super_globals();
$phpbb_user_id = user_add($user_row);

 if ($config['email_enable'])
            {
               include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);

               $messenger = new messenger(false);

    $messenger->template('user_welcome_inactive', $row['user_lang']);


               $messenger->to($data['email'], $data['username']);

               $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
               $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
               $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
               $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);

               $messenger->assign_vars(array(
				  'SITENAME'   => htmlspecialchars_decode($config['sitename']),
                  'WELCOME_MSG'   => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])),
                  'USERNAME'      => htmlspecialchars_decode($data['username']),
				  'U_BOARD'      => "thereef.io/forum/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey",
                  'EMAIL_SIG'   => "test")
               );
				   $messenger->send();
	 echo(htmlspecialchars_decode($data['email']));
 }
?>
 
Post Reply

Return to “phpBB Custom Coding”