CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Joomla! Installations (Moderator: Deepak Srivastava) »
  • BUGFIX: you need to do this to create CMS user from profile in Joomla 1.5
Pages: [1]

Author Topic: BUGFIX: you need to do this to create CMS user from profile in Joomla 1.5  (Read 2501 times)

undermyhat

  • Guest
BUGFIX: you need to do this to create CMS user from profile in Joomla 1.5
March 13, 2008, 05:06:11 am
Hi, was trying to create a new profile signup form for the frontend to allow people to sign up and also register a Joomla account at the same time. Although this has been documented in the tracker and changed, it still wasn't working in Joomla 1.5 for me: kept getting db field not existing errors. There seems to have been some changes to key fields in J1.5: in jos_core_acl_aro the field $aro_id is now called $id. (I only knew this from reading a thread re. Fireboard on J1.5...http://www.bestofjoomla.com/component/option,com_fireboard/Itemid,38/func,view/id,16659/catid,73/limit,10/limitstart,40/)

So I changed the following in CMS/Core/BAO/CMSUser.php:

around line 500

Code: [Select]
//Fetch aro_id of newly added acl*OLD*
       // $aro_id_sql   = "SELECT aro_id FROM {$table} where value = '$id'";
       // $aro_id_query = $db_cms->query( $aro_id_sql );
       // $aro_id_row   = $aro_id_query->fetchRow( DB_FETCHMODE_ASSOC ) ;
        //$aro_id       = $aro_id_row['aro_id'];

        //Fetch aro_id of newly added acl -*NEW* changed aro_id to id
        $aro_id_sql   = "SELECT id FROM {$table} where value = '$id'";
        $aro_id_query = $db_cms->query( $aro_id_sql );
        $aro_id_row   = $aro_id_query->fetchRow( DB_FETCHMODE_ASSOC ) ;
        $aro_id       = $aro_id_row['id'];

And it worked, refreshing the page to show the user profile.

THe only thing is, while the Civicrm correctly saves the First and Surname, the Joomla user only creates a record with username and name both the same (I.e. it loses the actual first and second name, and saves the username as 'name' AND 'username.  This must be because the function below only gets the 'username' and 'password' from the 'create user' form - this form doesn't have a field for actual name. If it did then it could use that, or I suppose it could try to capture the person's name from the profile fields...but how???

Code: [Select]
static function createJoomlaUser( &$params, $mail )
    {
        $config =& CRM_Core_Config::singleton( );
        $dao =& new CRM_Core_DAO( );
        $name = $dao->escape( $params['cms_name'] );
       
        $fname = trim($params['cms_name']);//this bit just sets the person's actual name as their user name in Joomla.
        $uname = trim($params['cms_name']);//this is the username in joomla
        $pwd   = md5($params['cms_pass']);
        $email = trim($params[$mail]);
        $date  = date('y-m-d h:i:s');

It would be really great to get the proper name in, can anybody give me an idea? I want to have the Joomla user set up like this (not just the username) so I can automatically give them access to other things like Community Builder, Groupjive etc.

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: BUGFIX: you need to do this to create CMS user from profile in Joomla 1.5
March 13, 2008, 06:14:22 am
So do I understand correctly that you have this working so that you have a single form (Civi Profile) where you collect user info to populate Civi and ALSO enable the person to register as a Joomla user? If so, that a significantly new (and important) improvement. Let me know if I understand correctly. And how did you add the joomla user reg fields to the profile form?
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

undermyhat

  • Guest
Re: BUGFIX: you need to do this to create CMS user from profile in Joomla 1.5
March 13, 2008, 08:25:24 am
In Civicrm>administer>profile I just ticked the box in the profile settings>advanced settings that said

Code: [Select]
[ ] Joomla account registration option'.
 Then it automatically displays the boxes in the frontend profile form. The only thing is that it doesn't collect the users real name - just the username. But it works at least!

Just tried enabling the bit that lets them then view their website profile:

Code: [Select]
[  ]  Include Joomla user account information links in search results?
Check this box if you want to include a links in the listings to view contacts' Joomla user account information (e.g. their 'My Account' page). This link will only be included for contacts who have a user account on your website.]-

but it didn't work on my site. I get 'do not have permission to execute this url' . Although I can see the link to website profile, can't access it. But this is probably way more complicated by my having community builder installed : )
« Last Edit: March 13, 2008, 08:28:06 am by undermyhat »

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: BUGFIX: you need to do this to create CMS user from profile in Joomla 1.5
March 15, 2008, 02:14:03 pm
I just want to highlight for all you Joomla users out there that this is a *new* function in 2.0 (which is why I was surprised to see the post about it). And it's great! It may seem like a small thing, but it's a really important piece of the Joomla+CiviCRM integration.

Big thanks to the core team!
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: BUGFIX: you need to do this to create CMS user from profile in Joomla 1.5
June 02, 2008, 08:50:29 pm
Do you have this working? (creating Joomla user through profile) I tried your mods and also the draft mods here:
http://forum.civicrm.org/index.php/topic,2325.0.html

Both give me errors about duplicate rows.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Joomla! Installations (Moderator: Deepak Srivastava) »
  • BUGFIX: you need to do this to create CMS user from profile in Joomla 1.5

This forum was archived on 2017-11-26.