Joined: 18 Dec 2003
Posts: 13497
Location: Behind You
Posted: 03/01/05 11:35
Just a few posts back it mentions that you need to merge the mambo and jamroom databases. I don't use these CMS things, but it is likely the problem since you have your DB's seperate.
Mambo and Jamroom together in 1 db - is this stial a valid option using versions 4.5.2 Mambo and 2.28 Jamroom?
Am a user of Mambo (earlier versions) and would like to create a site utilizing both programs but not sure whether to keep them seperate at first (databases seperate) or to have them merged to start with.
Joined: 15 Jan 2004
Posts: 954
Location: united kingdom
Posted: 03/18/05 13:26
Hey werkkrew
dont suppose you got the v1 of these modules anywhere have you ?
im still using mambo 4.5.0 and dont intend on upgrading for another 6 months yet,and i was looking for the Rating module, highest rated etc,.
cheers mate.
I am running phpBB inside mambo. This component uses a login module. You disable the mambo login and use the login module from the above link. This works fine. If I login to phpbb, it logs me into mambo. If I log into mambo it logs me into phpbb.
Now the problem - The first artist to create a new account in jamroom gets added to the mos_users table as id 0 (the administrator is id 62? and there is an Anonymous account with user id -1?) and gets added to the jamroom_user table as id 1 (the administrator is id 0). - ok, so the first user gets added in both tables.
The second user that creates a new account gets added to the jamroom_user table as user id 2. - (that's all good.) But I get this error when the post_user script tries to add the user to the mos_users table:
Code
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /config/post_user.php on line 53
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /config/post_user.php on line 58
failed to insert new user into the phpBB2 user table
MySQL error:1062 - Duplicate entry '0' for key 1
So, to me, it looks like the post_user script is not getting what our next user will be? It is trying to add the new user again as user id 0?
This is the post_user that I am using - from the latest download here:
http://www.jamroom.net/phpBB2/viewtopic.php?t=1168
Code
<?php
#------------------------------------------------------------
# Jamroom phpBB2 user-add post_user plug-in
# version 1.0 by Brian Johnson
#
# This Jamroom Post_User plug-in will create a user account
# in a phpBB forum when a user is added to Jamroom
#
# NOTE!! This plug in will only work with phpBB2 running in
# a MySQL database, and must be renamed to "post_user.php"
# before it will work.
#------------------------------------------------------------
# note: to see all of the available information that is
# exported into this plug-in, uncomment the following 2 lines
# this will prevent the user from being added to your phpBB,
# but will allow you to dump the incoming variables.
#debug($data,000000);
#exit;
#------------------------------------------------------------
# configuration
#------------------------------------------------------------
$phpbb_server = 'localhost'; // machine phpBB is running on
$phpbb_dbase = 'MyDataBaseName'; // phpBB Database name
$phpbb_user = 'MyDataBaseUserName'; // database user name
$phpbb_pass = 'MyDataBasePassword'; // database user password
$phpbb_prefix = 'mos'; // default phpBB2 table prefix
#------------------------------------------------------------
# You should not need to edit below here
#------------------------------------------------------------
# connect up to the mysql database
$con = mysql_connect($phpbb_server,$phpbb_user,$phpbb_pass)
or die("unable to connect to the phpBB2 database server!
# select our table
mysql_select_db($phpbb_dbase,$con)
or die("unable to open the phpBB2 database!
<br>MySQL error:". mysql_errno() .' - '. mysql_error());
# first - get what our next user_id is going to be
$rv = "SELECT MAX(user_id + 1) as new_id FROM {$phpbb_prefix}_users";
$rs = mysql_query($rv,$con);
if (mysql_num_rows($rs) > 0)
{
$_row = mysql_fetch_assoc($rs);
$new_id = $_row['new_id'];
}
mysql_free_result($rs);
# our user password comes in unencrypted - lets MD5 it
$pass = md5($data['user_password']);
# now build and run our query
$rv = "INSERT INTO {$phpbb_prefix}_users (
name,
username,
email,
password,
usertype,
block,
sendEmail,
gid,
registerDate )
VALUES (
'{$data['user_nickname']}',
'{$data['user_nickname']}',
'{$data['user_emailadr']}',
'{$pass}',
'user',
0,
0,
18,
". time() .")";
# run the query
mysql_query($rv,$con)
or die("failed to insert new user into the phpBB2 user table
<br>MySQL error:". mysql_errno() .' - '. mysql_error());
# log our success
jmLogger(0,'INF',"(user plugin) the user "{$data['user_nickname']}" was successfully added to Mambo");
WerKKreW,
Thanks for the reply and thanks for the modules!
I am using the post_user script from your packages.
It works great for the first user, or any user after that as long as there is not a user with the id 0 already there.
If I use phpmyadmin and change the id for the first user from 0 to any other number, the post user script will add the next user with no errors. (I gets added as user id 0)
I was wondering if the problem is here in the post user script:
Code
# first - get what our next user_id is going to be
$rv = "SELECT MAX(user_id + 1) as new_id FROM {$phpbb_prefix}_users";
$rs = mysql_query($rv,$con);
if (mysql_num_rows($rs) > 0)
{
$_row = mysql_fetch_assoc($rs);
$new_id = $_row['new_id'];
}
mysql_free_result($rs);
Joined: 20 Feb 2004
Posts: 126
Location: Phildadelphia, PA USA
Posted: 03/30/05 22:50
I pretty much just modded what bigguy had written to work with mambo, but on second glance, the id table is usually auto-increment, so theres no reason to specify an ID...