Custom User Registration Script Problem

11 years 11 months ago #54106 by Candrax
Hello fellas!

Due to my project customizations (wap version of the site) I have to code a custom registration script. My joomla 1.0.13 has also Community Builder installed to handle the users. The CB registration on my 'normal' site works fine but my custom script don't.

I've done the coding to the certain point when the annoying error appears (You are not authorised to view this resource.You need to login.) every time when a user, registered through the custom script try to activate their account through clicking on the activation link sent to their email, instead of activating the user.

My script inserts the user data in all of the 'user' tables in joomla and community builder ('jos_users', 'jos_comprofiler', 'os_core_acl_aro' and 'jos_core_acl_groups_aro_map'), and still I think that I'm making a mistake, which causes this error mentioned earlier.

Here's the SQL logic which I'm using:
[code:1]
$sql1="select * from jos_users where username='$userName' && email='$email'";
$result1=mysql_query($sql1);
$check=mysql_num_rows($result1);
if($check!=0)
{
$smarty->display('wml_retry.tpl');
}
else
{
$sql2="insert into jos_users values(null,'$fullName','$userName','$email','$password1','Registered',0,0,18,'$today','$today','','');";
mysql_query ($sql2) or die("Registration Failed.".$sql2);
$sql3="select * from jos_users where username='$userName'";
$result3=mysql_query($sql3);
$show=mysql_fetch_array($result3);
$userID=$show;
//echo $userID;
$sql4="insert into jos_comprofiler (id, user_id, firstname, lastname, hits, message_last_sent,
message_number_sent, avatarapproved, approved, confirmed, lastupdatedate,
registeripaddr, cbactivation, banned, acceptedterms)
values ($userID, $userID, '$firstName', '$lastName', 0, '0000-00-00 00:00:00',
0, 1, 1, 0, '0000-00-00 00:00:00', ' ', ' ', 0, 1);";

mysql_query ($sql4) or die("Registration Failed.".$sql4);
$sql5="insert into jos_core_acl_aro values(null, 'users', '$userID', 0, '$userName',0)";
$sql6="insert into jos_core_acl_groups_aro_map values (18,'','')";
mysql_query($sql5) or die("Registration Failed".$sql5);
mysql_query($sql6) or die("Registration Failed".$sql6);
$smarty->display('wml_confirmation.tpl');
$MailSend=sendMail($email,$confirmcode,$firstName,$lastName, $userName, $password);
if($MailSend==1)
{
$sql5="update jos_comprofiler set cbactivation='$confirmcode' where id=$userID";
mysql_query ($sql5) or die($sql5);
}
[/code:1]
Anybody have done this in the past, and knows the working solution??

Thank you so much in the advance!
11 years 4 months ago #70546 by curt0
I'm doing something very similarly and I have the same problem. Does anybody have a solution?

Where is the code that generates the jos_comprofiler.CBACTIVATION value?
10 years 11 months ago #84669 by girljinbink
So does this script work if you set joomla config to automatically activate users instead of sending the activation e-mail? Or have you conquered this problem since you made this post? ;)

I would love to see what you've done with the full form code - I have just a little PHP experience, and am wanting to do something very similar.
Moderators: beatnantkrileon
Time to create page: 0.581 seconds
Facebook Twitter Google LinkedIn