Two problems with User Registration and Community Builder

knotworking 23 Jun, 2013
I've been working on getting the Joomla registration function going with CB, finally got it working, but there were two changes I had to make to the joomla_registration.php file.

1. If you use delimiters in your registration to instruct the applicant on what/how to enter certain fields, the script insert query breaks. The script just queries #__comprofiler_fields for registration form fields, but does not account for fields like delimiters. On line 141, change
$database->setQuery( "SELECT * FROM #__comprofiler_fields WHERE `table`='#__comprofiler' AND name <>'NA' AND registration = '1'" );

to
$database->setQuery( "SELECT * FROM #__comprofiler_fields WHERE `table`='#__comprofiler' AND name <>'NA' AND registration = '1' AND type != 'delimiter'" );


2. I followed old workaround instructions on the "name" issue you face when adding a community builder profile, which wants "firstname" and "lastname" fields separately. I couldn't get it to work, the hidden name field I created would never get overridden, so I either got a "You must provide your name" error message or, when I added a dummy name to the hidden field, it stayed the hidden field dummy name. On line 57, I changed the code to this
$firstname = JRequest::getVar('firstname', '', 'post');
$lastname = JRequest::getVar('lastname', '', 'post');
$form->data['name'] = $firstname . " " . $lastname;


Hope this helps someone.
GreyHead 23 Jun, 2013
Hi knotworking,

Did you use the CB tab in the Joomla! Registration action to enable the CB compatibility?

I've never tried it myself but I know that Max had it working OK with CB when it was released.

Bob
knotworking 24 Jun, 2013
Yes I did, I am testing on the latest versions of both components. I don't think most CB users utilize the delimiters, probably why it's not come up before. The name vs. firstname/lastname issue, on the otherhand, seems like a problem needing a fix.

I tried everything I could think of to get it working. The $form->data setting for the name ignored the post name variable, so whatever the hidden "name" field value was, that was what got passed to the script. If the hidden value was blank, it would throw the missing name error, if it was pre-filled, it would insert than name in #__users. I was dumping all post variables right before name was assigned, the Jrequest-set name variable was there, the script just didn't take it into account.
This topic is locked and no more replies can be posted.