Forums / General Questions / Integrating PHPBB3 with Zencart

Integrating PHPBB3 with Zencart

Locked

Views: 41,750

Results 1 to 20 of 82
This thread is locked. New replies are disabled.
19 Jun 2007, 12:42 AM
#1
softcorpse avatar

softcorpse

Zen Follower

Join Date:
Aug 2004
Posts:
96
Plugin Contributions:
0

Integrating PHPBB3 with Zencart

MODERATOR NOTE: See this thread for a patch containing the collective changes discussed in this topic: http://www.zen-cart.com/forum/showthread.php?t=111251 .

I have been messing around with phpbb3 and integrating it into zencart where as you would sign up in zencart the registration details would be sent over to the phpbb3 database and create the user on the forum at the same time.

I have managed to get it all working except for one thing:

user_email_hash

At the moment I have the following:

$user_email_hash = crc32(strtolower($email_address));

As this is close, it is not 100% correct as the value I should get for the e-mail address [email protected] should be:

21079953813

However with the above sql I get a value of:

210799538

As you can see it is short the last 2 digits.

I would like to know what sql I should use to get the correct crc32 value to send across to the phpbb3 database.

Thank you for your time & help.

Here is the current code I am using:

// use separate db connection with details from phpBB config file

if ($sniffer->phpBB['installed'] == true) {
require($sniffer->phpBB['phpbb_path'] . 'config.php');

$user_email_hash = crc32(strtolower($email_address));

$db_phpbb = new queryFactory();
$db_phpbb->connect($dbhost, $dbuser, $dbpasswd, $dbname, USE_PCONNECT, false);
$sql = "select max(user_id) as total from " . $table_prefix . TABLE_PHPBB_USERS;
$phpbb_users = $db_phpbb->Execute($sql);
$user_id = ($phpbb_users->fields['total'] + 1);
$sql = "insert into " . $table_prefix . TABLE_PHPBB_USERS . "
(user_id, user_type, group_id, username, username_clean, user_password, user_email, user_email_hash, user_regdate, user_inactive_reason, user_passchg, user_lastmark, user_inactive_time, user_lang, user_timezone, user_dst, user_style, user_dateformat)
values
('" . (int)$user_id . "', 1, 2, '" . $nick . "', '" . $nick . "', '" . md5($_POST['password']) . "', '" . $email_address . "', '" . $user_email_hash . "', '" . time() ."', 1, '" . time() ."', '" . time() ."', '" . time() ."', '" . en ."', 2, 1, 4, 'D M d, Y g:i a')";

$db_phpbb->Execute($sql);
$group_id = $db_phpbb->Insert_ID();
$sql = "INSERT INTO " . $table_prefix . TABLE_PHPBB_USER_GROUPS . " (user_id, group_id, group_leader, user_pending)
VALUES ($user_id, 2, 0, 0)";

$db_phpbb->Execute($sql);
$db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE, USE_PCONNECT, false);
}
// End phppBB stuff

20 Jun 2007, 11:07 AM
#2
softcorpse avatar

softcorpse

Zen Follower

Join Date:
Aug 2004
Posts:
96
Plugin Contributions:
0

Re: Integrating PHPBB3 with Zencart

Excuse the bump, but does anyone have any idea as to what additional string I should use with "$user_email_hash = crc32(strtolower($email_address));" to get the correct crc32 value in the database?

Thanks

20 Jun 2007, 3:48 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Integrating PHPBB3 with Zencart

Have you checked the phpbb website for guidance on generating/calculating the correct hash?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

20 Jun 2007, 8:35 PM
#4
softcorpse avatar

softcorpse

Zen Follower

Join Date:
Aug 2004
Posts:
96
Plugin Contributions:
0

Re: Integrating PHPBB3 with Zencart

Yep, cannot find anything regarding zen and phpbb3...

6 Sep 2007, 3:13 PM
#5
commerce_fun avatar

commerce_fun

New Zenner

Join Date:
Jul 2007
Posts:
18
Plugin Contributions:
0

Re: Integrating PHPBB3 with Zencart

Hi anyone have succeed this ?

25 Sep 2007, 12:32 AM
#6
pewe avatar

pewe

Zen Follower

Join Date:
Aug 2006
Posts:
134
Plugin Contributions:
0

Re: Integrating PHPBB3 with Zencart

Is integration with Phpbb3 in the works?
Or has anyone done a working fix yet?

16 Dec 2007, 8:38 PM
#7
neilchen avatar

neilchen

New Zenner

Join Date:
Dec 2007
Posts:
1
Plugin Contributions:
0

Re: Integrating PHPBB3 with Zencart

you can try
'user_email_hash' => crc32(strtolower($user_row['user_email'])) . strlen($user_row['user_email'])

source:
http://forum.joomla.org/index.php?topic=173272.0;wap2

Could you please share with us when your great job is done?

23 Dec 2007, 4:38 PM
#8
lazerradial2003 avatar

lazerradial2003

New Zenner

Join Date:
Aug 2007
Posts:
14
Plugin Contributions:
0

Re: Integrating PHPBB3 with Zencart

Any update on this? Have been tinkering for a while and not getting anywhere as far as getting PHPBB3 to work with zen cart goes, any luck?

28 Dec 2007, 11:58 AM
#9
lazerradial2003 avatar

lazerradial2003

New Zenner

Join Date:
Aug 2007
Posts:
14
Plugin Contributions:
0

Re: Integrating PHPBB3 with Zencart

I've got a lot of it to work, only major problem now is generating the hashed password to store in the databsae, it used to be md5($password) but it's no longer this simple, if anyone can tell me the correct password hashing function and how to use it i think I can get PHPBB3 to work.

28 Dec 2007, 9:40 PM
#10
scraphutinc avatar

scraphutinc

New Zenner

Join Date:
Oct 2007
Posts:
11
Plugin Contributions:
0

Re: Integrating PHPBB3 with Zencart

I am interested in getting this to work as well. One issue that I see with the you would also want this to work in reverse as well so that a sign up on the forum creates a log in for Zen Cart. In a perfect world, the same login name and such would be used for both instead of using an email for one and a username for the other.

There is nothing happening on the PHPBB website. The only mention of Zencart is someone asking a question about integration. They say to ask the people at Zencart.

Scrap Hut - The Right Products, The Right Price, Right Now! http://www.scrap-hut.com

28 Dec 2007, 10:32 PM
#11
illusionguy avatar

illusionguy

Zen Follower

Join Date:
May 2007
Posts:
136
Plugin Contributions:
0

Re: Integrating PHPBB3 with Zencart

I am also looking to intergrate Zen Cart and phpBB3, Zen Cart and phpBB3 is like peanut butter and chocolate they just go togeather! It would also be nice to get phpBB to work within a page with in Zen Cart so that your customer never leaves your store.

29 Dec 2007, 9:30 AM
#12
sadr1an1 avatar

sadr1an1

New Zenner

Join Date:
Mar 2007
Posts:
28
Plugin Contributions:
0

Re: Integrating PHPBB3 with Zencart

I have succesfuly begin integration with phpbb3, all i have managed to do is sincronising account creation from zencart into phpbb. After the modification in admin section Configuration->My store->Enable phpBB linkage? = true, and the config file, i have to modify class.phpbb.php, just the following function:

function phpbb_create_account($nick, $password, $email_address) {
if ($this->phpBB['installed'] != true || !zen_not_null($password) || !zen_not_null($email_address) || !zen_not_null($nick)) return false;
if ($this->phpbb_check_for_duplicate_email($email_address) == 'already_exists') {
// $this->phpbb_change_email($old_email, $email_address);
} else {
$sql = "select max(user_id) as total from " . $this->phpBB['users_table'];
$phpbb_users = $this->db_phpbb->Execute($sql);
$user_id = ($phpbb_users->fields['total'] + 1);
$sql = "insert into " . $this->phpBB['users_table'] . "
( username,username_clean, user_password, user_email, user_regdate)
values
( '" . $nick . "','" . $nick . "', '" . md5($password) . "', '" . $email_address . "', '" . time() ."')";
$this->db_phpbb->Execute($sql);
//could do a check here to see if Insert_ID() matches $user_id...

// @TODO: MySQL5

    //$sql = "INSERT INTO " . $this->phpBB['groups_table'] . " (group_name, group_desc, group_single_user, group_moderator)
    //        VALUES (0, 'Personal User', 1, 0)";
    //$this->db_phpbb->Execute($sql);
    //$group_id = $this->db_phpbb->Insert_ID();
    $sql = "INSERT INTO " . $this->phpBB['user_group_table'] . " (user_id, group_id, user_pending)
            VALUES ($user_id, 2, 0)";
    $this->db_phpbb->Execute($sql);
    //might optionally send an extra email welcoming them to the phpBB forum, reminding them of their nickname?
  }
}

Now when i register a new user in zencart it will be registered in phpbb too.
Now i'm loking for something like wordpress integration: wordpress is oppend inside zencart. If iwon\t find anithing usefull this day i will start customisation myself.:wink:

2 Jan 2008, 11:00 PM
#13
rainthebat avatar

rainthebat

Zen Follower

Join Date:
Feb 2007
Posts:
314
Plugin Contributions:
0

Re: Integrating PHPBB3 with Zencart

Hi sadr1an1,

It looks like you got the furthest. Could you be a little more explicit in your instructions, I can't find the code that you are replacing.

2 Jan 2008, 11:21 PM
#14
lazerradial2003 avatar

lazerradial2003

New Zenner

Join Date:
Aug 2007
Posts:
14
Plugin Contributions:
0

Re: Integrating PHPBB3 with Zencart

Great work sadr1an1, this has been driving me crazy, your function works a treat.

rainthebat: the file is includes/classes/class.phpbb.php and you need to replace the function phpbb_create_account with sadr1an1's version of it.

Next step would be to find a way of combining sessions, so that logging into either the forum or zen cart logged the user into the other part of the site. Any suggestions from anyone?

7 Jan 2008, 5:22 PM
#15
frenchy avatar

frenchy

New Zenner

Join Date:
Dec 2006
Location:
france
Posts:
3
Plugin Contributions:
0

Re: Integrating PHPBB3 with Zencart

Génial sadr1an1,

Ça fonctionne parfaitement. :clap:

Cordialement..........

9 Jan 2008, 6:52 PM
#16
madmumbler avatar

madmumbler

Zen Follower

Join Date:
Dec 2005
Location:
SWFL
Posts:
450
Plugin Contributions:
0

Re: Integrating PHPBB3 with Zencart

Yes!!! I finally got it to work!!!

Not sure exactly what I did.... LOL

I had to hack the templates/template_default/templates/tpl_modules_create_account.php

and saved it to my custom template folder so it would display the nickname field.

I had to set the phpBB forum to default to Registered User for new members. (It wasn't before, and I've never used phpBB before, so it took me a while to figure it out.) Once I did that, it allowed new users to post.

muwaHAHAHAHAHA!!!!!! :jump:

On to conquering the world! Well, okay, Joomla login. But YAY ME!

THANK YOU sadr1an1!!!!!!!!!

Lesli in SW Florida ~ writer, teacher, and dodging hurricanes!

9 Jan 2008, 7:54 PM
#17
madmumbler avatar

madmumbler

Zen Follower

Join Date:
Dec 2005
Location:
SWFL
Posts:
450
Plugin Contributions:
0

Re: Integrating PHPBB3 with Zencart

Okay, I realized that while it does pass the user across the database to populate the forum, it doesn't pass the login status.

Anyone have any ideas how to do that?

Lesli in SW Florida ~ writer, teacher, and dodging hurricanes!

10 Jan 2008, 7:09 PM
#18
neteasy avatar

neteasy

Zen Follower

Join Date:
Mar 2004
Location:
Ontario, Canada
Posts:
128
Plugin Contributions:
2

Re: Integrating PHPBB3 with Zencart

I have to update the CONFIG table in PHPBB3 so the newest member will be displayed on the PHPBB3 homepage

    function phpbb_create_account($nick, $password, $email_address) {
      if ($this->phpBB['installed'] != true || !zen_not_null($password) || !zen_not_null($email_address) || !zen_not_null($nick)) return false;
      if ($this->phpbb_check_for_duplicate_email($email_address) == 'already_exists') {
//        $this->phpbb_change_email($old_email, $email_address);
      } else {
        $sql = "select max(user_id) as total from " . $this->phpBB['users_table'];
        $phpbb_users = $this->db_phpbb->Execute($sql);
        $user_id = ($phpbb_users->fields['total'] + 1);
//        $sql = "insert into " . $this->phpBB['users_table'] . "
//                (user_id, username, user_password, user_email, user_regdate)
//                values
//                ('" . (int)$user_id . "', '" . $nick . "', '" . md5($password) . "', '" . $email_address . "', '" . time() ."')";
        $sql = "insert into " . $this->phpBB['users_table'] . "
                ( username,username_clean, user_password, user_email, user_regdate, user_passchg, group_id, user_permissions, user_sig, user_occ, user_interests, user_email_hash)
                values
                ( '" . $nick . "','" . $nick . "', '" . md5($password) . "', '" . $email_address . "', '" . time() . "', '" . time(). "', 2, '', '', '', '', '" . crc32(strtolower($email_address)) . strlen($email_address) . "')";
        $this->db_phpbb->Execute($sql);
//could do a check here to see if Insert_ID() matches $user_id...

	$sql = "SELECT user_id, username, user_colour
		FROM " . $this->phpBB['users_table'] . "
		WHERE user_type IN ('0', '3')
		ORDER BY user_id DESC LIMIT 1";
	$phpbb_newest_user = $this->db_phpbb->Execute($sql);

	$sql = "UPDATE " . $this->phpBB['config_table'] . "
		SET config_value = '" . $phpbb_newest_user->fields['user_id'] . "'
		WHERE config_name = 'newest_user_id'";
	$this->db_phpbb->Execute($sql);
	
	$sql = "UPDATE " . $this->phpBB['config_table'] . "
		SET config_value = '" . $phpbb_newest_user->fields['username'] . "'
		WHERE config_name = 'newest_username'";
	$this->db_phpbb->Execute($sql);	
	
	$sql = "UPDATE " . $this->phpBB['config_table'] . "
		SET config_value = '" . $phpbb_newest_user->fields['user_colour'] . "'
		WHERE config_name = 'newest_user_colour'";
	$this->db_phpbb->Execute($sql);	
	
	$sql = "UPDATE " . $this->phpBB['config_table'] . "
		SET config_value = config_value + 1 
		WHERE config_name = 'num_users'";
	$this->db_phpbb->Execute($sql);

// @TODO: MySQL5

//      $sql = "INSERT INTO " . $this->phpBB['groups_table'] . " (group_name, group_desc, group_single_user, group_moderator)
//              VALUES (0, 'Personal User', 1, 0)";
//      $this->db_phpbb->Execute($sql);
//      $group_id = $this->db_phpbb->Insert_ID();
        $sql = "INSERT INTO " . $this->phpBB['user_group_table'] . " (user_id, group_id, user_pending)
                VALUES ($user_id, 2, 0)";
        $this->db_phpbb->Execute($sql);
        //might optionally send an extra email welcoming them to the phpBB forum, reminding them of their nickname?
      }
    }

Chinese language pack
Zen Cart **plugins demo** includes Ultimate SEO, Image Handler, Template Switch, Column Layout, Lightbox and Multi-Language EZ-Pages

10 Jan 2008, 7:41 PM
#19
madmumbler avatar

madmumbler

Zen Follower

Join Date:
Dec 2005
Location:
SWFL
Posts:
450
Plugin Contributions:
0

Re: Integrating PHPBB3 with Zencart

I didn't have to do that -- it passed them through okay for me. Just not the login status.

Lesli in SW Florida ~ writer, teacher, and dodging hurricanes!

10 Jan 2008, 7:58 PM
#20
neteasy avatar

neteasy

Zen Follower

Join Date:
Mar 2004
Location:
Ontario, Canada
Posts:
128
Plugin Contributions:
2

Re: Integrating PHPBB3 with Zencart

but phpbb3 will not show the correct "newest member" and "total members" if I use sadr1an1's function

zencart user has to login to PHPBB3 separately.

Chinese language pack
Zen Cart **plugins demo** includes Ultimate SEO, Image Handler, Template Switch, Column Layout, Lightbox and Multi-Language EZ-Pages