Support » Plugin: BP Profile Search » "Warning: Invalid argument supplied for foreach() …"

  • Resolved BackpackersUnion


    Hi Andrea,

    Thanks for your work on this plugin. I went to utilize some of the new features and found this warning next to “Form Field:” and all fields missing;

    Warning: Invalid argument supplied for foreach() in /home/**removed-username**/public_html/wp-content/plugins/bp-profile-search/bps-functions.php on line 148

    I have no code experience, but this is what it’s referencing (top line is 148);

    foreach ($bps_options['field_name'] as $k => $id)
    		if (empty ($fields[$id]))  continue;
    		$label = $bps_options['field_label'][$k];
    		$desc = $bps_options['field_desc'][$k];

    Where the search toggle should be in the Members Directory, it now says “BP Profile Search : Error, you have not configured your search form.”. It appears this is a result of the most recent update. Do you know what might be causing these warnings and errors and a possible fix? Thanks for your help.

    WordPress 3.8.2, Multisite, BuddyPress 1.9.2.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Andrea Tarantini



    Thanks for reporting this bug, I’m going to fix it in a few days.

    In the meantime you could try and save the settings, that should correct the problem.

    Hi Andrea, Thanks for getting right back to me. Saving the settings did clear the warning and allow me to add new fields to the search form. Thank you!

    One thing I thought was worth pointing out; If there is a field description already set in the “BuddyPress custom profile filed”, it shows up by default on the search form. If you delete the description in the Plugin settings and save it, it shows back up after the page refreshes. Not a big issue, but it makes it so the descriptions fields can not be left blank. You must add a new description or keep the imported one.

    Lastly, ever think of making a search plugin for the user Activity page? There are a few tutorial to add searches to the Activity feed but no plugins available.

    Thanks for your support and the plugin!

    Plugin Author Andrea Tarantini


    Hi BackpackersUnion,

    I’ve released the fix for the bug you reported.

    To leave a description blank, enter a single space character. It’s not a very elegant way, but it works.

    Your suggestion for an Activity Search is interesting, I’ll explore it as soon as I have some available time. Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘"Warning: Invalid argument supplied for foreach() …"’ is closed to new replies.