Jump to content

PHPBB auto register on customer signup


herpherp

Recommended Posts

Hello,

 

I was wondering if anyone with mysql & php experience could assist in finishing this code up.

It works as stand alone code but when I use it in an action hook it tries to add the tables for the registration process into the forums database and throws errors as the tables do not exist in the forums database, I know I could combine the two database but for security reasons I want to keep them seperate.....

 

Here's the sloppy code that registers a user I am attempting to add to the register action hook

define('IN_PHPBB', true);
global $phpbb_root_path;
global $phpEx;
global $db;
global $config;
global $user;
global $auth;
global $cache;
global $template;
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path = '../forum/';
require("/home/fullsrv/public_html/forum/common.php");
$user->session_begin();
$auth->acl($user->data);
require("/home/fullsrv/public_html/forum/includes/functions_user.php");
$user_row = array(
'username' => $vars["FirstName"],
'user_password' => md5('$vars["Password"]'),
'user_email' => $vars["Email"],
'group_id' => '2',
'user_timezone' => '1.00',
'user_dst' => 0,
'user_lang' => 'en',
'user_type' => '0',
'user_actkey' => '',
'user_style' => '1',
'user_dateformat' => 'd M Y H:i',
'user_regdate' => time(),
);
$phpbb_user_id = user_add($user_row);

 

This does register the customer in phpbb once I sign up with whmcs but then I either get a white screen or again the errors trying to add to the wrong database... How would I get it to stop using phpbb now and go back to setting whmcs....

 

If I reload/refresh the white screen or error screen everything goes through/ the customers order and I am forwarded to the payment gateway as normal...

 

Once I get this working I am also going to need to figure out something to either add to the $vars["FirstName"] etc... Any assistance in completing this would be greatly appreciated as I am so close!

Link to comment
Share on other sites

you will be overiting the open connection link id for mysql

So after the end of you code reopen the connection to your whmcs database.

 

$db = mysql_connect($WhmcsServer,$WhmcsDbUserName,$WhmcsDBPassword)

 

That will reopen the conenction the the WHMCS DB so WHMCS can carry on what it was doing.

Link to comment
Share on other sites

I believe I tried this, but am going to attempt again, I've also tried closing the phpbb database and reopening the whmcs... part of the issue is that the databases are on the same server/localhost so when I attempt to close a connection it is closing all database connection...

 

I have code that is above this connection as well and it is trying to place that information in the phpbb database as well, I am not sure what order the functions are run on the actionhooks page, or if it even matters.... I will mess with it till I figure it out though thank you for the input and if anyone else has any further ideas let me know.

Link to comment
Share on other sites

got it working had to use some functions and else statements... still need to verify that it is not interfering with anything else though and integrate into whmcs password change... Need to figure out how to post forum username, pw into whmcs client area and build link... I will then remove registration options from phpbb and pw change options in phpbb... so basically only registered clients on my main site will be able to access the forums and the pw will be the same as their client area pw at all times...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated