Joomla!
http://forum.joomla.org/

[RESOLVED]RC3 breaks user parameters in Community Builder 1.1
http://forum.joomla.org/viewtopic.php?f=235&t=223385
Page 1 of 1

Author:  peajayess [ Mon Oct 15, 2007 11:47 pm ]
Post subject:  [RESOLVED]RC3 breaks user parameters in Community Builder 1.1

Using RC3 and Community Builder 1.1, in the CB Details, Edit->Update Your Profile, the following error appears.

Warning: Invalid argument supplied for foreach() in
/var/www/main/components/com_comprofiler/plugin/user/plug_cbcore/cb.core.php on line 240


This problem has been reported on the CB forum here.

http://www.joomlapolis.com/component/op ... /catid,43/

CB devs claim RC3 changed the user parameters API, and to report it as a bug here.

Please forgive me if this is a duplicate.  Tried searching for "com_comprofiler/plugin/user/plug_cbcore/cb.core.php on line 240" here and on google, and only found is reported on the CB forum so far.

Author:  Beat [ Tue Oct 16, 2007 12:59 am ]
Post subject:  Re: RC3 breaks user parameters in Community Builder 1.1

Thanks for reporting it here. This is the CB code which worked in RC2, and doesn't work anymore in RC3:

Code:
<?php
      if (class_exists("JUser")) {                  // Joomla 1.5 :
         $juser =& JUser::getInstance($user->id);
         $params =& $juser->getParameters();
         $params->loadSetupFile(JApplicationHelper::getPath( 'com_xml', 'com_users' ));
         // $result = $params->render( 'params' );
         if (is_callable(array("JParameter","getParams"))) {
            $result = $params->getParams( $name );   //BBB new API submited to Jinx 17.4.2006.
         } else {
...


the resulting foreach error is because $result  above is not an array as a result of the above function.

Steps to reproduce: install CB 1.1, and edit an user.

As RC3 didn't go through ex-Q&T WG, we couldn't test and catch that API change before 1.5 RC3 got released. Is it possible to fix that for RC4 ?

Thanks,

Author:  Jinx [ Tue Oct 16, 2007 11:53 am ]
Post subject:  Re: RC3 breaks user parameters in Community Builder 1.1

Beat,

The quick fix is removing this line :
$params->loadSetupFile(JApplicationHelper::getPath( 'com_xml', 'com_users' ));

and changing this : $params =& $juser->getParameters();
to                      : $params =& $juser->getParameters(true);

The JUser API now autoloads the params xml file. This was explained on the developer list a while ago. You might have missed that.

Cheers,

Johan

Author:  peajayess [ Tue Oct 16, 2007 3:07 pm ]
Post subject:  Re: RC3 breaks user parameters in Community Builder 1.1

Thanks Jinx!  That works great  :D

Author:  Jinx [ Tue Oct 16, 2007 6:52 pm ]
Post subject:  Re: [RESOLVED]RC3 breaks user parameters in Community Builder 1.1

The good news is also that you can give the getParameters function a path to load the xml file for each usertype. This give you alot of extra flexibility, for example, you can let it load your own xml files. If you have any question have the extra flexibility in JUser just put them on the 1.5 dev forum and i'll do my best to explain.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/