We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25663 MODX Staff
    • 12,272 Posts
    ganeshXL are you saying you have a phpBB forum integration done? And if so is it version 3.x?
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • 10449
      • 956 Posts


      Yes, although it’s not a 100% integration in both directions, i.e. not MODx <--> phpBB, but rather phpBB -> MODx.
      I decided only one app shall handle user-authentication (signup, login), not both. Otherwise you’re in a world of pain, with core-hacks all over the place.

      You can include this in your MODx-templates as a snippet:

      <?
      // http://www.phpbb.com/kb/article/phpbb3-sessions-integration/
      define('IN_PHPBB', true);
      $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
      $phpEx = substr(strrchr(__FILE__, '.'), 1);
      include($phpbb_root_path . 'common.' . $phpEx);
      
      // Start session management
      $user->session_begin();
      $auth->acl($user->data);
      $user->setup();
      ?>
      


      In your phpBB installation, include this hack in includes/functions_user.php:
      (approx. at line 179)
      
      @dl("php_curl.dll"); // only necessary on Windows
      $ch = curl_init();
      
      $modxUserData = array(	'email'				=> $sql_ary['user_email'],
      						'username'			=> $sql_ary['username'],
      						'fullname'			=> $sql_ary['username_clean'],
      						'password'			=> $sql_ary['user_password'],
      						'confirmpassword'	=> $sql_ary['user_password'],
      						'cmdwebsignup'		=> 'Submit'
      );
      
      $postVars = http_build_query($modxUserData);
      
      curl_setopt($ch, CURLOPT_URL, "http://localhost/modx-0962/index.php?id=53"); // URL of websignup form
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $postVars);
      curl_setopt($ch, CURLOPT_FAILONERROR, 1);
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
      curl_setopt($ch, CURLOPT_TIMEOUT, 3);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      $curlResult=curl_exec($ch);
      curl_close($ch);



      This will simply create a modx-user at the same time as phpbb.

      I only did this as a "proof of concept" over the weekend. I used the last stable versions of both apps (0.9.6.2 + 3.0.2). For a live-site you would have to deal with functions such as "send password reminder" or "change profile information" too, i.e. mirror those changes in modx, so that both apps are up-to-date.

      Of course, if you wanted to automatically create a forum user whenever someone registers via modx, it would mean a lot of additional work. But I frankly don’t see why you would use two separate user-databases. Especially if you start adding custom user-profile fields in the forum and want to replicate these inside modx.
        • 25663 MODX Staff
        • 12,272 Posts
        I agree with keeping all the user management functions in one place and applaud your effort. Well done!
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 25551 ☆ A M B ☆
          • 1,231 Posts
          Hi ganesh, would you be able to clarify if this works with those 2 pieces of code? Here’s what I done and I don’t see it working.

          I made a snippet called phpInclude and put the following in the snippet.

          <?
          // http://www.phpbb.com/kb/article/phpbb3-sessions-integration/
          define('IN_PHPBB', true);
          $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
          $phpEx = substr(strrchr(__FILE__, '.'), 1);
          include($phpbb_root_path . 'common.' . $phpEx);
          
          // Start session management
          $user->session_begin();
          $auth->acl($user->data);
          $user->setup();
          ?>


          I then installed a fresh 3.02 phpBB forum to /forum/ and opened up the includes/functions_user.php file.

          At line 179 I have;

          
          @dl("php_curl.dll"); // only necessary on Windows
          $ch = curl_init();
          
          $modxUserData = array(	'email'				=> $sql_ary['user_email'],
          						'username'			=> $sql_ary['username'],
          						'fullname'			=> $sql_ary['username_clean'],
          						'password'			=> $sql_ary['user_password'],
          						'confirmpassword'	=> $sql_ary['user_password'],
          						'cmdwebsignup'		=> 'Submit'
          );
          
          $postVars = http_build_query($modxUserData);
          
          curl_setopt($ch, CURLOPT_URL, "http://mysite/register"); // URL of websignup form
          curl_setopt($ch, CURLOPT_POST, 1);
          curl_setopt($ch, CURLOPT_POSTFIELDS, $postVars);
          curl_setopt($ch, CURLOPT_FAILONERROR, 1);
          curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
          curl_setopt($ch, CURLOPT_TIMEOUT, 3);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
          $curlResult=curl_exec($ch);
          curl_close($ch);
          
          
          // LINE 179 starts here -  These are the additional vars able to be specified
          	$additional_vars = array(
          		'user_permissions'	=> '',
          		'user_timezone'		=> $config['board_timezone'],
          		'user_dateformat'	=> $config['default_dateformat'],


          I put the phpInclude snippet in the content box of my register page only, is this the correct setup? Thanks.
            Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
            AugmentBLU - MODX Partner

            BLUcart - MODX Revolution E-Commerce & Shopping Cart
            • 10449
            • 956 Posts
            You probably have a websignup form that waits for captcha form-vars; hence your posts are not being accepted. there’s a parameter you can simply change, like &useCaptcha=`0` (too lazy to look it up now).

                // verify form code
                if($useCaptcha && $_SESSION['veriword']!=$formcode) {
                    $output = webLoginAlert("Incorrect form code. Please enter the correct code displayed by the image.").$tpl;
                    return;
                }


            Also, for security’s sake, you should define one or two extra (bogus) vars in the websignup form, and send these only via the forum-signup process.
            If someone finds your modx-websignup form by accident - a bot or malicious hacker; easy enough if you just check all index.php?id=1-999 URLs - and tries to register via original modx-weblogin page, you should have a method in place to stop this person. Either that or redirect to your phpBB register-page.

            Hence, you could just add one dummy post-var in websignup.inc.php:

                $origin = $modx->db->escape($modx->stripTags($_POST['originOfRequest']));
            if(!$origin || $origin != "phpBBRegisterPage") {
                    $output = webLoginAlert("Please use the forum registration page for new signups. Thanks.").$tpl;
            return;
            }
            



            and add one more matching CURL-var here:

            $modxUserData = array(	
            	'email'	=> $sql_ary['user_email'],
            	'username' => $sql_ary['username'],
            	'fullname' => $sql_ary['username_clean'],
            	'originOfRequest' => 'phpBBRegisterPage', // <-- here
            	'password' => $sql_ary['user_password'],
            	'confirmpassword' => $sql_ary['user_password'],
            	'cmdwebsignup' => 'Submit'
            );
              • 27330
              • 884 Posts
              will it also handles the login. ie if a user is logged in to modx he don’t need to login again to phpBB?

              This is one addition I’ve been waiting for ages. thanks so much. may I know if you are you planning on improving it or is it going to stay in the proof of concept area?
                • 10449
                • 956 Posts
                I don’t think so. I’m lacking motivation, frankly speaking. It feels a bit like reinventing the wheel. There’s many CMS out there with fully integrated forums out of the box, so why waste time and effort?
                  • 20413
                  • 2,877 Posts
                  Master! Don’t leave us!!  wink

                  We will work out and make you proud!!  laugh

                  Lol! You should make this and then sell it ...cheap!  grin
                    @hawproductions | http://mrhaw.com/

                    Infograph: MODX Advanced Install in 7 steps:
                    http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                    Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                    http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                    • 25551 ☆ A M B ☆
                    • 1,231 Posts
                    There’s many CMS out there with fully integrated forums out of the box, so why waste time and effort?

                    If everyone thought that way with MODx then MODx wouldn’t be here... I think the reason why myself and others want to have integration is because forums are an important part of any community and we don’t want 2 separate logins. We want to use MODx for the amazing features and unique features but use similar options that a lot of other CMS have.

                    Maybe some reverse psychology here might work... I don’t think anyone is capable of integrating a forum in to MODx simple LOL. In all seriousness, I think the addition of a integration for one set forum at least would be at a good start. Use the most stable release of modx and a stable forum release and use that a test bed.

                    I just don’t think anyone is able to integrate it and use the why bother reason! I’ve seen Ganesh getting phpbb to register a user with modx which was awesome but the password was wrong, it was passing the actual hashed key to the password field in modx. I know someone might do it for money which is fair enough, I can imagine that it’s hard to do but I would say that some of the things that have came out of this community that have all been free is a sign that large and difficult projects have been completed without the need for cash. I am one who would be willing to put in some cash to get a truely integrated forum, I just can’t fund thousands.

                    It’s on my Xmas list and was on the list last Xmas, modx and a forum integrated please Santa... he never brought me my wish and i’ve been a good boy for years. LOL
                      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                      AugmentBLU - MODX Partner

                      BLUcart - MODX Revolution E-Commerce & Shopping Cart
                      • 6726
                      • 7,075 Posts
                      Nice to see there is some effort under way !
                      Might need this for modxcms.fr since I use phpBB3 for the board.

                      A quick way to perform SSO when the board system also has a module for it is openID

                      Check the modx snippet : http://modxcms.com/forums/index.php?topic=13979.0

                      And phpbbOpenID : http://phpbbopenid.com/

                      Might be a quick and dirty way to handle this, that is if you don’t expect any other feature than SSO.
                        .: COO - Commerce Guys - Community Driven Innovation :.


                        MODx est l&#39;outil id