Fix Invalid argument supplied for foreach() in cb.core.php on line 240

I come across this bug when I tried to edit user profile on my community builder v1.1 and Joomla 1.5. I found out that many people face the same problem at community builder forum, but unfortunately the forum is hard to navigate and finding the solution is like looking for needle in stack of straws. So here is the solution:

You will need to edit com_comprofiler/plugin/user/plug_cbcore/cb.core.php on around line 528 and 529. Do the following edit:

  1. Change this line “$params =& $juser->getParameters(); to “$params =& $juser->getParameters(true);
  2. Then comment out or remove this line “$params->loadSetupFile(JApplicationHelper::getPath( ‘com_xml’, ‘com_users’ ));”

There you are, now it won’t show any error message when you try to edit user profile in your community builder v1.1 and Joomla v1.5. Looking forward for CB v1.2.

This answer is courtesy of Jinx and can be found at http://forum.joomla.org/viewtopic.php?t=223385.