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:
- Change this line “$params =& $juser->getParameters();“ to “$params =& $juser->getParameters(true);“
- 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.
Tags: bug fix, community builder, joomla
















October 22nd, 2008 at 9:19 am
You ROCK! this is exactly what I needed
October 30th, 2008 at 8:46 am
Excellent thanks! Got this with one search on Google. Brilliant!
November 6th, 2008 at 3:22 pm
Great job, i was finding this solution for few days. You are good people. Willing to share. support!
November 8th, 2008 at 10:36 am
awesome stuff, thanks!
November 8th, 2008 at 10:37 am
Great stuff, fixed the problem, thanks!
November 11th, 2008 at 5:09 am
10x
December 3rd, 2008 at 10:54 am
Thank you!
January 11th, 2009 at 4:54 am
;( it gives me another error Parse error: syntax error, unexpected T_STRING in public_html/components/com_comprofiler/plugin/user/plug_cbcore/cb.core.php on line 1
January 11th, 2009 at 6:07 pm
please make sure that you are using community builder v1.1. and try to have a look your cb.core.php for any special character on the first line. Otherwise, you can email me your cb.core.php and I will have a look. I will send you my email address.
January 12th, 2009 at 12:07 am
i check cb.core.php from my server by download it from my server to localdisk, then i compare it with one originally extracted from cb_1_1_0-unzip1st.zip
Wow in the beginning of cb.core.php from my server i found there’s space between lines. so i upload a new one to server and voillaaaaa…. no error
thanks. but still dont know what is the difference between those files
—-
here cb.core.php from my server:
<?php
/**
* Core plugin with tab classes for: Portrait and Contact Tabs for handling the core CB tab api
* @version $Id: cb.core.php 609 2006-12-13 17:30:15Z beat $
* @package Community Builder
* @subpackage Page Title, Portrait, Contact tabs CB core plugin
* @author JoomlaJoe and Beat
* @copyright (C) JoomlaJoe and Beat, http://www.joomlapolis.com and various
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU/GPL version 2
and here from cb_1_1_0-unzip1st.zip
<?php
/**
* Core plugin with tab classes for: Portrait and Contact Tabs for handling the core CB tab api
* @version $Id: cb.core.php 609 2006-12-13 17:30:15Z beat $
* @package Community Builder
* @subpackage Page Title, Portrait, Contact tabs CB core plugin
* @author Beat and JoomlaJoe
* @copyright (C) Beat, JoomlaJoe, http://www.joomlapolis.com and various
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU/GPL version 2
January 12th, 2009 at 4:22 pm
They differ because you have opened the file in different OS. if you get file that sit on unix server via FTP into your windows PC and edit the file, that may create additional blank spaces. Windows and Unix/Linux use different Line break characters. Tips to get over this, try to set your FTP to binary mode or set your editor to use Linux line break (only advanced editor supports this). Cheers.
January 14th, 2009 at 3:22 am
Thanks. It solved my problem.
February 15th, 2009 at 6:20 am
Perfect!
Thank you for such a quick and easy fix.
February 18th, 2009 at 8:37 pm
hi,
i tried editing the php file using phpDesigner and i could not find the same code for line 528 and 529.
line 528 is a blank space.
line 528:
line 529: $aro_id = $acl->get_object_id( ‘users’, $my->id, ‘ARO’ );
perhaps its got something to do with the editor?