Forums

Custom Joomla Registration

Juliusm31 26 Nov, 2010
Hi,

I'm running Chrono Contact V 3.2 with chronocontact plugin V3.1 RC5.2.

I've already built the form, I simply need somebody to get it to work because I'm an idiot. Here's what I have so far:

A custom Joomla Registration Form with the following fields:

Name
Email
Zip
And a checkbox that will confirm user subscription to additional future correspondence. Like "I will Email you if it's sunny outside (Check for Yes/ Leave blank for No)."

Like I said, form is already built but I've worn out my options.

At this point, I can register a user, log the user in automatically, and send the admin-side email with all the data submitted in the form. That's perfect and no additional work needs to be done there. I'll connect the database myself.

But it doesn't send the user his/her password or username from which they will login in future. That's where I fall into the abyss.

To help, I'll include the fixes I've tried to get this far and also so that you know exactly what the component looks like at this point.

From the forum I was given this code and included it in com_chronocontact/plugins/cf_joomla_registration.php:

First, on line 455:
if ( $params->get('autologin') ) {
            $credentials = array();
            $credentials['username'] = $post['username'];
            $credentials['password'] = $post['password2'];
            $mainframe->login($credentials);
        }


The above code replaced:

if ( $params->get('autologin') ) {
            $credentials = array();
            $credentials['username'] = $post['username'];
            $credentials['password'] = JRequest::getVar($params->get('pass'), '', 'post', 'string', JREQUEST_ALLOWRAW);
            $mainframe->login($credentials);



Second, on line 416:

$password = $post['password2'];


The above code replaced:

$password = JRequest::getString($params->get('pass'), '', 'post');


As I said, my user still doesn't receive a password in his/her email.

Third, I was given this to replace what was on line 426:

$MyFormEmails->emails[$emailid - 1]->enabled = 1;
$MyFormEmails->emails[$emailid - 1]->template = str_replace("{vlink}", JURI::base()."index.php?option=com_user&task=activate&activation=".$user->get('activation'), $MyFormEmails->emails[$emailid - 1]->template;

$MyFormEmails->emails[$emailid - 1]->template = str_replace("{user}", $post['username'], $MyFormEmails->emails[$emailid - 1]->template);
$MyFormEmails->emails[$emailid - 1]->template = str_replace("{pass}", $post['password2'], $MyFormEmails->emails[$emailid - 1]->template);

$Myemail = array($MyFormEmails->emails[$emailid - 1]);


The above code did not work at all and threw a parse error, locking me out of the component all together. I then replaced the above code with this:

$MyFormEmails->emails[$emailid - 1]->enabled = 1;
    $MyFormEmails->emails[$emailid
    - 1]->template = str_replace("{vlink}",
    JURI::base()."index.php?option=com_user&task=activate&activation=".$user->get('activation'),
    $MyFormEmails->emails[$emailid - 1]->template);

    $MyFormEmails->emails[$emailid
    - 1]->template = str_replace("{user}", $post['username'],
    $MyFormEmails->emails[$emailid - 1]->template);
    $MyFormEmails->emails[$emailid
    - 1]->template = str_replace("{pass}", $post['password2'],
    $MyFormEmails->emails[$emailid - 1]->template);

    $Myemail = array($MyFormEmails->emails[$emailid - 1]);


Note the extra trailing ")" behind $MyFormEmails->emails[$emailid - 1]->template);

Whether this is correct I have no idea. But at least I can get into the component right now which is an improvement of sorts.

So essentially what I need is for my user to receive an email with his/her auto-generated password and the username to correspond with the field Name...in my case it's text_1.

The user also needs to be redirected to my registration, instead of the core Joomla registration.

The problem might have something to do with my user not entering a Username per se. I don't know. I'm running out of time and ran out of patience about 150 hours ago.

I'll give you admin access to the site if you want to check it out first.

I can't afford much at this point but I'd be willing to pay US$75-00 if you can get my form to work.

Thank you,

Julius
GreyHead 26 Nov, 2010
Hi Julius,

Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.

Bob
This topic is locked and no more replies can be posted.