I have noticed that my pn_uid is not the traditional 1,2,3,4,5,6....etc. After some years of use they are more like 1,2,3,4,43,6,7,43,9,200,10....
When I use the pnCPG "Update Coppermine users from Postnuke", it assumes that my users are sequential and assigns a CPG user_id sequentially. What I've done here is try to modify the code to SELECT the pn_uid and INSERT it to user_id. It seems to work, but not 100%, wondered if someone could sanity check my mods. I think the problem is related to $teller.
In pnadmin.php I changed this:
// Load Postnuke users
$results = mysql_query( "SELECT pn_uname,pn_email FROM $_pn_prf LIMIT 0 , 999999" );
//store the result in a PHP array for multiple use
$dbdata=array();
$dbdata1=array();
$usr_num = 0;
while($row = mysql_fetch_array($results)) {
$usr_num ++;
$dbdata[$usr_num]=$row[0];
$dbdata1[$usr_num]=$row[1];
}
// is there another database owner, let's connect
if ($_dbhost !==""){
$link = mysql_connect($_dbhost, $_dbuser, $_dbpw) or mysql_error();
}
$true = mysql_select_db($db) ;
$teller = 0;
while ($teller < $usr_num ){
$teller ++ ;
$username = $dbdata[$teller];
$usermail = $dbdata1[$teller];
// Check if already added to Coppermine
$results1 = mysql_query( "SELECT * FROM $_cpg_prf WHERE user_name=$username " );
$num_rows1 = mysql_num_rows($results1);
// if not there, add the account
if ($num_rows1 < 1){
$cpg_pwd = ranpass() ;
$adding = mysql_query("INSERT INTO $_cpg_prf(user_group, user_active,user_name, user_password,user_lastvisit, user_regdate,user_email) VALUES ('2','YES', '$username','$cpg_pwd',NOW(), NOW(),'$usermail')");
To this:
// Load Postnuke users
$results = mysql_query( "SELECT pn_uid,pn_uname,pn_email FROM $_pn_prf LIMIT 0 , 999999" );
//store the result in a PHP array for multiple use
$dbdata=array();
$dbdata1=array();
$dbdata2=array();
$usr_num = 0;
while($row = mysql_fetch_array($results)) {
$usr_num ++;
$dbdata[$usr_num]=$row[0];
$dbdata1[$usr_num]=$row[1];
}
// is there another database owner, let's connect
if ($_dbhost !==""){
$link = mysql_connect($_dbhost, $_dbuser, $_dbpw) or mysql_error();
}
$true = mysql_select_db($db) ;
$teller = 0;
while ($teller < $usr_num ){
$teller ++ ;
$pnuserid = $dbdata[$teller];
$username = $dbdata1[$teller];
$usermail = $dbdata2[$teller];
// Check if already added to Coppermine
$results1 = mysql_query( "SELECT * FROM $_cpg_prf WHERE user_name=$username " );
$num_rows1 = mysql_num_rows($results1);
// if not there, add the account
if ($num_rows1 < 1){
$cpg_pwd = ranpass() ;
$adding = mysql_query("INSERT INTO $_cpg_prf(user_id, user_group, user_active,user_name, user_password,user_lastvisit, user_regdate,user_email) VALUES ('$pnuserid', '2','YES', '$username','$cpg_pwd',NOW(), NOW(),'$usermail')");
My concern is that I have 5660 CPG users, and 5669 PN users...