Integrate Zencart 1.3.8 with phpbb3

These are steps to integrate zencart 1.3.8 with phpBB 3.0.1. These steps will ensure if a user create an account in Zencart, an account for the phpBB will also be created and your phpbb3 display appropriate Total number of user and Newest Member nickname at the board index.

1. Install your phpbb3 and ensure it runs perfectly.

2. Open your configure.php inside /includes folder of your Zen-Cart installation and edit this configuration define(‘DIR_WS_PHPBB’, ‘…..Your  Path to your phpbb3 ….’); with correct physical path to your phpbb installation. It must be your physical path! NOT your relative path. For example of physical path see your ‘DIR_FS_CATALOG’ value inside the same configure.php (ensure you have ‘/’ at the end of the path).

3. Enable link to your phpbb3 from your zencart administrator. Inside your zencart administrator go to “Configuration” -> “My Store” and set “Enable phpBB Linkage?” to TRUE.

4. edit class.phpbb.php inside your …/includes/classes folders. Try to find phpbb_create_account function and replace with the following code.

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, group_id, username, username_clean, user_password, user_email, user_regdate) values ('" . (int)$user_id . "',2, '" . $nick . "', '" . $nick . "', '" . md5($password) . "', '" . $email_address . "', '" . time() ."')";
		$sql = "update phpbb_config SET config_value = '{$user_id}' WHERE config_name = 'newest_user_id'";
		$sql = "update phpbb_config SET config_value = '{$nick}' WHERE config_name = 'newest_username'";
		$sql = "update phpbb_config SET config_value = config_value + 1 WHERE config_name = 'num_users'";
		$sql = "INSERT INTO " . $this->phpBB['user_group_table'] . " (user_id, group_id, user_pending) VALUES ($user_id, 2, 0)";

5. Enjoy your nicely integrated phpbb3 forum with zencart. From now on, if a user register an account in Zen-Cart, they will be registered in PHPBB as well.

If you have follow my instruction correctly, now when you create new account in Zen-Cart you will be asked to provide “Forum Nick Name”. You can login in the forum using the Forum Nick Name you have provided and your Zencart password.

Optional: You can manually copy Zen-Cart account that has been setup previously to phpbb user database to integrate them. Next, you can create theme that reflect your store for your phpBB forum. I will not go into detail in here and ZC developers should be able to do these. PS: if you find better solution please let me know 🙂

15 Replies to “Integrate Zencart 1.3.8 with phpbb3”

  1. Thanks for the directions, however I still have a problem logging into my phpbb with the new user account. The user exists, but the password appears to be incorrect.

  2. That is interesting. I have done integration ZC138 with PHPBB3 with one of my client and it works smoothly. Have you changed the user password via Zencart? If you can not login after you change the user’s password in ZC, then try to replace the “phpbb_change_password” function inside class.phpbb.php with this one:

    function phpbb_change_password($nick, $newpassword) {
    if ($this->phpBB[‘installed’] != true || !zen_not_null($nick) || $nick == ”) return false;
    $sql = “update ” . $this->phpBB[‘users_table’] . ” set user_password='” . md5($newpassword) . “‘
    where username = ‘” . $nick . “‘”;
    $phpbb_users = $this->db_phpbb->Execute($sql);

  3. Hmm…I hadn’t changed the password at all — I tried creating a new user and then logging into the phpbb after they registered. It’s a completely clean install of both ZC and phpbb with no contributions or other code mods.

    I should also mention that your write up is perfect. I wish half the contributions were that clear. I’m thinking the problem has to do with the way the password is encrypted in the database.

  4. I have just spent some time to investigate this. You are right, it turns out that PHPBB3 does not use md5 encryption for the password. It use some kind of Portable PHP password hashing framework (Written by Solar Designer at You can see the hash/encryption function at “includes\functions.php” file in your phpbb3 installation directory.

    However, I figured out that PHPBB3 also accept md5 hashing. Have a look at your “phpbb_check_hash” function inside “includes\functions.php”. My PHPBB version is 3.0.1 and the default function from phpbb looks like this:

    function phpbb_check_hash($password, $hash)
    $itoa64 = ‘./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz’;
    if (strlen($hash) == 34)
    return (_hash_crypt_private($password, $hash, $itoa64) === $hash) ? true : false;

    return (md5($password) === $hash) ? true : false;

    Note the last line code. What actually happen is if your password in database encrypted using md5() which is 32 characters long, it will still log you in then phpbb3 will replace the md5 hash with its hashing system (your password remain the same, it just rehash into its hashing system).

    I suspect there is something wrong with your class.phpbb.php at ZC.
    1. Well to make sure, just try to create new user in ZC with password = “admin” (do not include the quotes).
    2. Then browse your “users” table for your phpbb3 database. Find your new user data and the user_password field should have this value : “21232f297a57a5a743894a0e4a801fc3” (this is the md5 value for “admin”).
    If it does not try to fix your “class.phpbb.php” in ZC because there is something wrong with it 🙂

  5. Curiouser and curiouser. . . the hash value was correct. I tried to login and couldn’t — then I tried again and could. Then I tried again and couldn’t (with a new user name)…

    I’m now wondering if its a caching issue.

    Back to the drawing board!

  6. Okay, it\’s not a caching issue. The user is in the database. However the error given when attempting to login is that the username is not found. If I login my administrator account, the user is visible when I click on the find a member link — however if I search for the member their name is not found.

  7. Hi,
    I am having the same problem as Tif. I’m not sure though where the users table is so that I can check to see if the password code is right. This is all very new to me sorry if that was a “duh” question.

  8. Hi Jessica and Tif, Today I checked again and ensure I follow my steps as written in this blog. Guess what? It works seamlessly for me. I don’t know what happened with your installations. I think there could be a misunderstanding here, so I have updated my instructions and include more details. Have a look at let me know if it still does not work.

    If you are not ZC geek or editing zencart code sounds scary for you, you can download this phpbb class file for zencart and replace yours to ensure you perform the editing correctly:

    Remember to backup the old file before you edit or replace.
    PS: You will not be able to login using account that already registered prior the integration!. These integration steps will ensure new ZC user registration will also register it to phpBB forum. You should manually copy the old ZC account database.

  9. I tried the new stuff that you wrote and now I\’m getting an error on line 179. I guess that I\’m doing something wrong since you are getting it to work. I don\’t have a place to type in my forum nickname when they sign up as a new user. My ZC is a little older I\’m running version Zen Cart
    Database Patch Level:
    Do I have to update my Zen Cart to get it to work?
    I had to set my configure.php settings to 444 so that I wouldn\’t get the error that my configure file is being written to.
    Please help I would really love to get this to work.

  10. Hey,

    I tried your zip file but am not able to login to the forums with the nickname i chose when setting up a new user account in Zen cart , i am running Zen Cart 1.3.8a Database Patch Level: 1.3.8 and Download phpBB 3.0.1

  11. Hey…me again…it worked, i kept on creating new users on the zen cart with same email address, went and deleted the user in the phpbb db and tried my luck one more time and voila!!!!!


  12. Hi there. I have phpbb 3.0 installed with zencart 1.3.8a. Both were installed using fantastico and were assigned separate databases.

    The directory to each install is as follows:

    /home/server_name/public_html/forum (for phpbb3)
    /home/server_name/public_html/store (for zencart 1.3.8a)

    Like many of you, I’m having issues integrating the login systems for the two applications. I’m not a database expert by any means so I was wondering if the installation could be my issue. Do the installations need to be in the same directory and share teh same database?

    Thanks in advance

  13. Hello.

    I’m also having trouble integrating my phpbb (v 3.0.0) forum along with my zencart (v 1.3.8a).

    My phpbb forum was installed into the following directory:

    My zencart was intalled afterwards into the following directory:

    Both were installed with fantastico and assigned separate databases.

    I’ve made the changes you’ve suggested and the zencart registration requests for a forum nickname but the customer info does not transfer over to the phpbb tables. Zencart registration works fine. Could the installation and structure be causing the problem?

    Thanks in advance for the help!

  14. I know this is a 4 year old blog, but, it appears quite high in the google listings for anyone searching about PHPBB3 integration with zen-cart. As posted, this blog is almost correct and will work with the latest phpbb3 and zen-cart 1.3.9 but ONLY if a serious oversight on 1 line of the code posted above is corrected.

    $sql = “insert into ” . $this->phpBB[‘users_table’] . “(user_id, group_id, username, username_clean, user_password, user_email, user_regdate) values (‘” . (int)$user_id . “‘,2, ‘” . $nick . “‘, ‘” . strtolower($nick) . “‘, ‘” . md5($password) . “‘, ‘” . $email_address . “‘, ‘” . time() .”‘)”;

    Also, you need to ReplaceAll > with a grater than sign, something in this blog messed up the text formatting.

Leave a Reply

Your email address will not be published. Required fields are marked *