Topic: Using PunBB in a content manager system!

It would be GREAT if anyone could help on this, and tell if it is possible.
I am running a PunBB forum installed for itself in a mySQL database called punbb.

It was a part of a site i had, which was only using normal html. For a short time ago, I went over to a content manager called Mambo (www.mamboserver.com) I installed Mambo in a new mySQL called mambo.
Now visitors can register on the site, but there is one problem. The members on the site, and the members on the forum is different. I want it like this: When a member register on the site, it will also be a member in the forum. I mean like putting the site and forum together..
The site is new, and I can delete members or the whole site if necessary - but I want to keep the forum, it has got many members...

What should I do? Does anyone know, or have tried Mambo before? Can't I just reinstall Mambo in the same mySQL-database as PunBB? Or what? What is suggested?

I have heard rumours that I will have to delete the forum, and to make Mambo work together with a forum, I need a special forum that Mambo supports. One of them is 'Simple Machines'. To be honest, I like PunBB better than all other forums in the world. I would hate to go over to Simple Machines... if I have to, is there a converter to Simple Machines? Is there any other converters than Chacmoals?

Please give me suggestions and help, I really appreciate it! Please tell me if anything is unclear, if I described bad somewhere (my english is not very good).

Re: Using PunBB in a content manager system!

hcgtv is thinkign of making a site for just this kind of project http://punbb.org/forums/viewtopic.php?pid=34193#p34193 it would need some kind of ported version of punbb to be integrated

3

Re: Using PunBB in a content manager system!

Andorin, this thread discussed Mambo integration: http://punbb.org/forums/viewtopic.php?id=4231

Maybe you can contact Gardener and see what the status is.

4

Re: Using PunBB in a content manager system!

First, you'd need both punBB and Mambo in the same database.  Use the prefix option when installing the forum and cms, and the tables will look something like this:

punBB_users
punBB_posts
punBB_etc
mambo_users
mambo_posts
mambo_etc

That's the easy part.  Next it sounds like you need to tie in the login/user system of the forum with the login/user system of the cms.  I'm guessing here, but if you know a little PHP and mySQL it might be relatively easy to modify one of the 'register.php' files so that it registers the user for both systems at the same time.  I'd see if I could edit punBB's register.php file so that when the user registers, it sends info to the user table for both punBB and Mambo.  Then set things up so there's only the punBB register page, of course, and hide the mambo register page.

5

Re: Using PunBB in a content manager system!

D9r wrote:

That's the easy part.  Next it sounds like you need to tie in the login/user system of the forum with the login/user system of the cms.

That was the approach we took with Nucleus: http://punbb.org/forums/viewtopic.php?id=6278

Everything in one database with tables prefixes:
nucleus_  has 19 tables
punbb_ has 17 tables

Now the user still has to sign on at each app to establish cookies, but from that point on, as long as they are a frequent visitor, no more signons.

Re: Using PunBB in a content manager system!

D9r wrote:

First, you'd need both punBB and Mambo in the same database.  Use the prefix option when installing the forum and cms, and the tables will look something like this:

Will I have to re-install both Mambo and the forum? Does that mean that I have to loose all members and posts in the forum, and all content at the homepage? Can I make a complete backup of PunBB, then re-install the forum with prefix as you said, then use the backup to get all members back? If I do as you say, would it work then?

I'll try, but I can't loose all members and posts in the forum, like starting all over again..

7

Re: Using PunBB in a content manager system!

Andorin, if you have phpMyadmin you can rename files.

Then change the config.php file in punbb to:
$db_prefix = 'punbb_';

8 (edited by D9r 2005-02-13 22:30)

Re: Using PunBB in a content manager system!

You don't have to reinstall punbb - just rename the tables.  The first step is to convert your punbb database so that each table has the 'punbb_' prefix.  Once that's done, install mambo's tables in that same database using 'mambo_' for their prefix.  (the punbb database data will be saved, but mambo's will be lost - you said this was ok).

Your punbb database probably looks like this:
users
posts
topics

and it needs to be:
punbb_users
punbb_posts
punbb_topics

Do you have access to your database via phpMyAdmin?  If so it's really easy to make changes without knowing what you're doing.  Go to the database, select the table 'users', click the 'operations' tab, under 'Rename table' change 'users' to 'punbb_users', click 'go'.  Repeat for each of the other punbb tables.  The whole procedure will only take a couple minutes.  When finished, go to your config.php file and add in the prefix.  If you aren't sure how to add it in, you could do a test install and see how the install file prints it - or ask someone here.  Once this is done your punbb database should work as before.  Next, just install mambo's tables in the same database using 'mambo_' for the prefix.

9

Re: Using PunBB in a content manager system!

Looking at phpMyAdmin further, it looks like you could also copy over the mambo database into your new punbb database without losing any of the mambo data.  Experiment and see.

Re: Using PunBB in a content manager system!

Okay. Today I am going to try it. I hope I won't destroy anything! D=
But hey, can't I backup the forum before I start? Can't find it in the admin-area...where?
So this is what I will do:

1. Go to phpMyAdmin and change the forum database to the same name as the mambo-database.
2. Find the config.php-file of the forum and edit $db_prefix = 'punbb_'; to $db_prefix = 'mambo_'; (I think I called the Mambo-site database that)
3. ...

Okay, is this right? Am I doing something wrong? I am really anxeious to do something wrong and loose all members. Can anyone please make a list of what to do to make it right? Step by step? I was a little confused of all posts here..  I really appreciate help! Thanks a lot folks! smile

Re: Using PunBB in a content manager system!

you can't just do that, it won't just magically integrate itself, i suggest you DO NOT TRY TO DO THIS ON A LIVE SITE, it will need doing carefully and tested, you could setup a test server ( www.wampserver.com ) and set it all up on that and work on it, in short you can't just use the mambo user table as the punbb one

12 (edited by Andorin 2005-02-16 12:09)

Re: Using PunBB in a content manager system!

I'm not sure, but I will start with editing registration.php in Mambo, right? So that when a user register on the site, he will also be registered in the forum?

Here is the "registration.php" in Mambo:



<?php
/**
* @version $Id: registration.php,v 1.19 2004/09/22 00:12:41 prazgod Exp $
* @package Mambo_4.5.1
* @copyright (C) 2000 - 2004 Miro International Pty Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* Mambo is Free Software
*/

/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

$task = mosGetParam( $_REQUEST, 'task', "" );
require_once( $mainframe->getPath( 'front_html' ) );

switch( $task ) {
    case "lostPassword":
    lostPassForm( $option );
    break;

    case "sendNewPass":
    sendNewPass( $option );
    break;

    case "register":
    registerForm( $option, $mosConfig_useractivation );
    break;

    case "saveRegistration":
    saveRegistration( $option );
    break;

    case "activate":
    activate( $option );
    break;
}

function lostPassForm( $option ) {
  global $mainframe;
  $mainframe->SetPageTitle(_PROMPT_PASSWORD);
    HTML_registration::lostPassForm($option);
}

function sendNewPass( $option ) {
    global $database, $Itemid;
    global $mosConfig_live_site, $mosConfig_sitename;

    $_live_site = $mosConfig_live_site;
    $_sitename = $mosConfig_sitename;

    // ensure no malicous sql gets past
    $checkusername = trim( mosGetParam( $_POST, 'checkusername', '') );
    $checkusername = $database->getEscaped( $checkusername );
    $confirmEmail = trim( mosGetParam( $_POST, 'confirmEmail', '') );
    $confirmEmail = $database->getEscaped( $confirmEmail );

    $database->setQuery( "SELECT id FROM #__users"
    . "\nWHERE username='$checkusername' AND email='$confirmEmail'"
    );

    if (!($user_id = $database->loadResult()) || !$checkusername || !$confirmEmail) {
        mosRedirect( "index.php?option=$option&task=lostPassword&mosmsg="._ERROR_PASS );
    }

    $database->setQuery( "SELECT name, email FROM #__users"
    . "\n WHERE usertype='superadministrator'" );
    $rows = $database->loadObjectList();
    foreach ($rows AS $row) {
        $adminName = $row->name;
        $adminEmail = $row->email;
    }

    $newpass = mosMakePassword();
    $message = _NEWPASS_MSG;
    eval ("\$message = \"$message\";");
    $subject = _NEWPASS_SUB;
    eval ("\$subject = \"$subject\";");

    mosMail($mosConfig_mailfrom, $mosConfig_fromname, $confirmEmail, $subject, $message);

    $newpass = md5( $newpass );
    $sql = "UPDATE #__users SET password='$newpass' WHERE id='$user_id'";
    $database->setQuery( $sql );
    if (!$database->query()) {
        die("SQL error" . $database->stderr(true));
    }

    mosRedirect( "index.php?Itemid=$Itemid&mosmsg="._NEWPASS_SENT );
}

function registerForm( $option, $useractivation ) {
    global $mainframe, $database, $my, $acl;

    if (!$mainframe->getCfg( 'allowUserRegistration' )) {
        mosNotAuth();
        return;
    }


  $mainframe->SetPageTitle(_REGISTER_TITLE);
    HTML_registration::registerForm($option, $useractivation);
}

function saveRegistration( $option ) {
    global $database, $my, $acl;
    global $mosConfig_sitename, $mosConfig_live_site, $mosConfig_useractivation, $mosConfig_allowUserRegistration;
    global $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_mailfrom, $mosConfig_fromname;

    if ($mosConfig_allowUserRegistration=="0") {
        mosNotAuth();
        return;
    }

    $row = new mosUser( $database );

    if (!$row->bind( $_POST, "usertype" )) {
        echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
        exit();
    }

    mosMakeHtmlSafe($row);

    $row->id = 0;
    $row->usertype = '';
    $row->gid = $acl->get_group_id('Registered','ARO');

    if ($mosConfig_useractivation=="1") {
        $row->activation = md5( mosMakePassword() );
        $row->block = "1";
    }

    if (!$row->check()) {
        echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
        exit();
    }

    $pwd = $row->password;
    $row->password = md5( $row->password );
    $row->registerDate = date("Y-m-d H:i:s");

    if (!$row->store()) {
        echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
        exit();
    }
    $row->checkin();

    $name = $row->name;
    $email = $row->email;
    $username = $row->username;

    $subject = sprintf (_SEND_SUB, $name, $mosConfig_sitename);
    $subject = html_entity_decode($subject, ENT_QUOTES);
    if ($mosConfig_useractivation=="1"){
        $message = sprintf (_USEND_MSG_ACTIVATE, $name, $mosConfig_sitename, $mosConfig_live_site."/index.php?option=com_registration&task=activate&activation=".$row->activation, $mosConfig_live_site, $username, $pwd);
    } else {
        $message = sprintf (_USEND_MSG, $name, $mosConfig_sitename, $mosConfig_live_site);
    }

    $message = html_entity_decode($message, ENT_QUOTES);
    // Send email to user
    if ($mosConfig_mailfrom != "" && $mosConfig_fromname != "") {
        $adminName2 = $mosConfig_fromname;
        $adminEmail2 = $mosConfig_mailfrom;
    } else {
        $database->setQuery( "SELECT name, email FROM #__users"
        ."\n WHERE usertype='superadministrator'" );
        $rows = $database->loadObjectList();
        $row2 = $rows[0];
        $adminName2 = $row2->name;
        $adminEmail2 = $row2->email;
    }

    mosMail($adminEmail2, $adminName2, $email, $subject, $message);

    // Send notification to all administrators
    $subject2 = sprintf (_SEND_SUB, $name, $mosConfig_sitename);
    $message2 = sprintf (_ASEND_MSG, $adminName2, $mosConfig_sitename, $row->name, $email, $username);
    $subject2 = html_entity_decode($subject2, ENT_QUOTES);
    $message2 = html_entity_decode($message2, ENT_QUOTES);

    // get superadministrators id
    $admins = $acl->get_group_objects( 25, 'ARO' );

    foreach ( $admins['users'] AS $id ) {
        $database->setQuery( "SELECT email, sendEmail FROM #__users"
            ."\n WHERE id='$id'" );
        $rows = $database->loadObjectList();

        $row = $rows[0];

        if ($row->sendEmail) {
            mosMail($adminEmail2, $adminName2, $row->email, $subject2, $message2);
        }
    }

    if ( $mosConfig_useractivation == "1" ){
        echo _REG_COMPLETE_ACTIVATE;
    } else {
        echo _REG_COMPLETE;
    }

}

function activate( $option ) {
    global $database;

    $activation = trim( mosGetParam( $_REQUEST, 'activation', '') );

    $database->setQuery( "SELECT id FROM #__users"
    ."\n WHERE activation='$activation' AND block='1'" );
    $result = $database->loadResult();

    if ($result) {
        $database->setQuery( "UPDATE #__users SET block='0', activation='' WHERE activation='$activation' AND block='1'" );
        if (!$database->query()) {
            echo "SQL error" . $database->stderr(true);
        }
        echo _REG_ACTIVATE_COMPLETE;
    } else {
        echo _REG_ACTIVATE_NOT_FOUND;
    }
}

function is_email($email){
    $rBool=false;

    if(preg_match("/[\w\.\-]+@\w+[\w\.\-]*?\.\w{1,4}/", $email)){
        $rBool=true;
    }
    return $rBool;
}
?>



Where should I edit?

After that, do I have to re-install either the forum or the site? Or can I keep both sites and edit prefix through phpMyAdmin? If i understood right, I should first go to the PunBB-database and change

users
posts
topics

to

punbb_users
punbb_posts
punbb_topics

with all tables?



And after that, I go to config.php in PunBB and change the table-information so it matches?

I'm no master in this, so it would be very nice if anyone could correct me and help me further.

Re: Using PunBB in a content manager system!

Nooo. I renamed all tables to "punbb_name", and changed the prefix to punbb_ in config.php

I get this error message when opening the forum:

An error was encountered
Error: Unable to fetch user information.


What does that mean? What could be wrong?

Re: Using PunBB in a content manager system!

Andoring: http://punbb.org/docs/faq.html#faq2_7

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Using PunBB in a content manager system!

Andoring? D=

Anyway, I forgot to change the mySQL name in the config.php, that's why it wouldn't work. I am stupid, oh yeah.
The forum is working fine now in the new database, now all I have left is the registration and login.

Re: Using PunBB in a content manager system!

Now both Mambo and PunBB is installed in the same database, and with the right prefix.
What would be the next step? When somebody register at the page, they should register at the forum at the same time. But I don't where in the code (and which code) to make that. Suggestions? Anyone?

Re: Using PunBB in a content manager system!

Sorry for bumping again, but I'm near giving this up. I might have to use SMF or PhpBB instead of PunBB, and that would be horrible. Can't anyone here answer post #16?

Re: Using PunBB in a content manager system!

i would do the integration but i just don't have time to take on another big task, sorry

Re: Using PunBB in a content manager system!

Andorin wrote:

Now both Mambo and PunBB is installed in the same database, and with the right prefix.
What would be the next step? When somebody register at the page, they should register at the forum at the same time. But I don't where in the code (and which code) to make that. Suggestions? Anyone?

if i'm not mistaken you can't just install mambo and punbb's database together and expect them to know what each other means/wants when the db is called upon. you will need to "translate" for lack of a better word, the language that both punbb and mambo speak and build a "translater" plugin/hack for mambo and punbb so the users that register for each portion can be administered. or just search the mambo sites for a wrapper plugin/module and just use the forum without any user registration for the mambo side of things. who knows there might already bea punbb + mambo module/plugin.

short of it is it's not as simple as mambo and punbb using the same db.

~James
FluxBB - Less is more