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.

14 Replies to “Fix Invalid argument supplied for foreach() in cb.core.php on line 240”

  1. ;( 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

  2. 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.

  3. 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

  4. 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.

  5. 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?

Leave a Reply

Your email address will not be published. Required fields are marked *