Skip to:
Content
Pages
Categories
Search
Top
Bottom

Upgraded BP, now receiving “Warning: Invalid argument supplied for foreach()”


  • argoncobalt
    Participant

    @argoncobalt

    I just upgraded BuddyPress on my staging server. Previously it was version 2.4.3, now it’s 2.6.2. WordPress was also automatically upgraded recently to version 4.6.1 (my client and I are using WP Engine, which automatically upgrades every so often).

    However, once I upgraded BP, I began receiving a warning on the member directory portion of the website.

    Here is a link to the staging site, specifically the page giving me a problem, the member directory: https://goo.gl/m6IKrs

    I keep receiving repeats of the following warning, one for every single profile picture: Warning: Invalid argument supplied for foreach() in /nas/content/staging/ltb/wp-content/plugins/buddypress/bp-xprofile/classes/class-bp-xprofile-field.php on line 266

    And then on individual profile pages, I receive the warning once.

    Does anybody know what could be causing this?

Viewing 7 replies - 1 through 7 (of 7 total)

  • Paul Wong-Gibbs
    Keymaster

    @djpaul

    I haven’t seen this on my dev site, and I don’t think we’ve had reports of this, so… as it’s staging, please can you switch the theme temporarily to a default WordPress theme, like twenty-twelve (etc) — and then visit this same URL again and see if the warning is still being printed or not?

    I suspect it’s something in your theme, maybe one of the templates, or some customisation hooked into the members loop, but switching the theme is an easy way to start figuring out possible causes.


    argoncobalt
    Participant

    @argoncobalt

    Hi Paul, thanks for the tip. I tried doing that and the warnings went away. So it must have something to do with the theme. I’ll begin looking into it. If you have any suggestions, I would appreciate hearing them. Thanks!


    argoncobalt
    Participant

    @argoncobalt

    I just pushed the entire site from live to staging again, overriding the BP upgrade, just to double check and make sure it actually was due to the upgrade, and the issue is still there. What’s funny is that the warning doesn’t show up on the live site. So it must be a problem due to the staging setup.


    Paul Wong-Gibbs
    Keymaster

    @djpaul

    On any decent server config, warnings and errors will not be shown on screen in production environments. Instead, it’ll be written to a log file. So you will still have the problem.

    Try switching back to your real theme (so the warning comes back), and then disable plugins one-at-a-time. See if you can figure out if it’s a combination of one plugin and your theme causing the problem.

    Is this a custom theme you wrote? Or did you buy from somewhere? Are BuddyPress templates defined in the theme (it’d be in your_theme/buddypress/ subfolder)? If it’s isolated to only your theme and not your theme+plugins, you’re going to have to debug through the members templates and figure it out.


    argoncobalt
    Participant

    @argoncobalt

    I’m wondering if maybe I should just ignore the warning then. Warnings aren’t the same as errors anyway, and everything is working just fine on the production site. I’m contemplating disabling warning messages for now.

    I’m just coming into the project now, I don’t know anything about the theme or where it came from. I assume my client had another developer build it at some point.


    Paul Wong-Gibbs
    Keymaster

    @djpaul

    If you don’t have dev resources to track it down and if the site isn’t on GitHub publicly or something, it’s going to be veeeeery difficult to come up with any meaningful suggestions where to look. I’m not sure where to start.


    argoncobalt
    Participant

    @argoncobalt

    Thanks for letting me know. Just got in touch with my client to see if they would be okay with giving you access to our code base. Will let you know what they say.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Skip to toolbar