WordPress.org

Ready to get started?Download WordPress

Forums

Integrating user database of punbb and wordpress so that user database is common (6 posts)

  1. nettribal
    Member
    Posted 7 years ago #

    Hi,

    I need to integrate my punbb forums user database and the wordpress user database so that they have a coomon database. i.e users can post comments / posts in both with a single user / password

    After searching around in support forums I still havent been able to find a solution.

    If somebody has done something similar, please help.

    Thanks,
    NetTribal

  2. alakhnor
    Member
    Posted 7 years ago #

    I don't know any plugin like this.

    Best I have (until I finally take time to do better ;) ) is this: http://www.alakhnor.info/blog2/extensions/plugin-wordpun/

    gives: navbar, stats, info, quickjump, login, avatars, last posts, and so on.

  3. cleanup
    Member
    Posted 7 years ago #

    Greetings!

    I've used punbb along with another piece of software (sitelok). First you would have to decide which database will be the primary database. I chose the sitelok database to be the one controlling the logins, and then modified the sitelok login script to log in the user to punbb. Also in that modification, I did a lookup on the user in punbb... if they weren't there, I inserted them into the punbb database. I'm not sure this is an optimal solution, maybe there's a better way, using WP as the primary database. Anybody out there have suggestions? FYI, I posted the code I used in sitelok, below.

    Emily

    // EKB Add login to punbb
    // Feb 11 2007
    define('PUN_ROOT', '/path/to/punbb/');
    require PUN_ROOT.'include/common.php';
    
    // Load the login.php language file
    require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';
    
    $form_username = $_POST['username'];
    $form_password = $_POST['password'];
    
    $username_sql = ($db_type == 'mysql' || $db_type == 'mysqli') ? 'username=\''.$db->escape($form_username).'\'' : 'LOWER(username)=LOWER(\''.$db->escape($form_username).'\')';
    
    $result = $db->query('SELECT id, group_id, password, save_pass FROM '.$db->prefix.'users WHERE '.$username_sql) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
    			list($user_id, $group_id, $db_password_hash, $save_pass) = $db->fetch_row($result);
    
    $authorized = false;
    
    if (!empty($db_password_hash))
    {
    	$authorized = true;
    	$form_password_hash = pun_hash($form_password);
    }  // end if we found a user record
    
    // if we don't find the person, assume they just haven't been in the forum yet.
    // Insert them into the database... using the same user info as sitelok
    if (!$authorized) {
    	$sql = 'INSERT INTO '.$db->prefix.'users (username, group_id, password, email, email_setting, save_pass, timezone, language, style, registered, registration_ip, last_visit) VALUES(\''.$db->escape($form_username).'\', 4, \''.pun_hash($form_password).'\', \''.$Email.'\', 2, 1, -5, \''.$db->escape($pun_config['o_default_lang']).'\', \''.$pun_config['o_default_style'].'\', '.time().', \''.get_remote_address().'\', '.time().')';
    	$result = $db->query($sql) or error('Unable to insert user into punbb', __FILE__, __LINE__, $db->error());
    	$result = $db->query('SELECT id, group_id, password, save_pass FROM '.$db->prefix.'users WHERE '.$username_sql) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
    	list($user_id, $group_id, $form_password_hash, $save_pass) = $db->fetch_row($result);
    }  // end if not authorized
    
    // Update the status if this is the first time the user logged in
    if ($group_id == PUN_UNVERIFIED)
    	$db->query('UPDATE '.$db->prefix.'users SET group_id='.$pun_config['o_default_user_group'].' WHERE id='.$user_id) or error('Unable to update user status', __FILE__, __LINE__, $db->error());
    
    // Remove this users guest entry from the online list
    $db->query('DELETE FROM '.$db->prefix.'online WHERE ident=\''.$db->escape(get_remote_address()).'\'') or error('Unable to delete from online list', __FILE__, __LINE__, $db->error());
    
    $expire = ($save_pass == '1') ? time() + 31536000 : 0;
    pun_setcookie($user_id, $form_password_hash, $expire);
    // end punBB login
  4. alakhnor
    Member
    Posted 7 years ago #

    The main problem would be that you can still manage user profiles separately, then change one of the passwords.

  5. nettribal
    Member
    Posted 7 years ago #

    Thanks guys,

    still trying unless we get a direct socket into the WP user database and modify punbb to fuly access that and that only instead of its own DB then we can probably get it going. The solution sadly is still evading me. :-)

  6. Bloody
    Member
    Posted 7 years ago #

    Cleanup,
    Your code is a plugin for Wordpres or code to put in Punbb register.php file ?
    Can you give me how to use this code.
    I am very interested about that.
    I'm using Alakhnor (french compatriot)plugin on my site, but i'm want more integration.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags