Support

Home Forums Event Espresso Premium Error: Invalid argument supplied…

Error: Invalid argument supplied…

Posted: July 21, 2022 at 9:43 am

Viewing 10 reply threads


tedcumpston

July 21, 2022 at 9:43 am

I have an error message that is displayed in my admin panel of Warning: Invalid argument supplied for foreach() in /home/customer/www/laallergysociety.org/public_html/wp-content/plugins/event-espresso-core-reg/core/libraries/form_sections/strategies/display/EE_Select_Display_Strategy.strategy.php on line 68

I have re-installed WP 6.0.1, and the core EE files but still get this error. I have the software installed on a sister site and I don’t have the error there. Any ideas on how to fix the issue?


tedcumpston

July 21, 2022 at 9:49 am

UPDATE: I turned off all plugins and have EE Core (4.10.36) and Event Espresso-WP Users (2.0.18) active, and I get the error message on the settings page of WP-users. I also can’t change the default role for user creation. All of the roles are greyed out.


Tony

  • Support Staff

July 22, 2022 at 7:35 am

Hi there,

The warning you posted will likely be related to the select field for the default roles (which is also likely why you are getting fields grey out).

However, I can’t reproduce this on my test sites, bit of an odd issue.

I assume you don’t have any custom code hooking into EE’s inputs running at all?

Which PHP version?

Can you add a screenshot of the page? (Not sure how much it’ll help, but maybe)

https://eventespresso.com/wiki/troubleshooting-checklist/#screenshots


tedcumpston

July 22, 2022 at 8:33 am

This reply has been marked as private.


Tony

  • Support Staff

July 22, 2022 at 8:40 am

Do you have a staging copy of the site running into the same issue? If so I can add some debug code there to see what is happening.


tedcumpston

July 22, 2022 at 8:42 am

This reply has been marked as private.


Tony

  • Support Staff

July 22, 2022 at 9:14 am

Hmm, ok so I checked the WP User integration code and it is using the $wp_roles global set up by WordPress itself.

So… something on that site is altering that global.

The add-on is doing…

global $wp_roles;

.... {a bunch of unrelated code here} ...

'default_wp_user_role'   => new EE_Select_Input(
    $wp_roles->get_names(),
    array(
        'html_label_text'         => esc_html__(
            'Default role for User Creation on Registration.',
            'event_espresso'
        ),
        'html_help_text'          => esc_html__(
            'On new events, when User creation is set to yes, this setting indicates what the default role for new users will be on creation. You can still override this on each event.',
            'event_espresso'
        ),
        'default'                 => isset(
            EE_Registry::instance()->CFG->addons->user_integration->default_wp_user_role
        )
            ? EE_Registry::instance()->CFG->addons->user_integration->default_wp_user_role
            : 'subscriber',
        'display_html_label_text' => false
    )
),

So it’s just pulling the names of the roles from the global set-up by WP and passing them into the EE_Select_Input constructor.

You said you disabled all plugins above, did you literally mean ALL plugins or all EE plugins? Are all of the sites running the membership plugin that one is?


tedcumpston

July 22, 2022 at 9:21 am

Yes, I deactivated all plug-ins and only had the core EE and wp-users plug-ins active. Same error. I changed the theme to a wp default theme with all plug-ins on and off, same error. All my other sites are running the same membership plug-in, with the same settings for EE and I don’t have any issues. I’m scratching my head where the difference is.


Tony

  • Support Staff

July 22, 2022 at 9:23 am

If you edit an event and look for the WP user integration settings there, do they show the same issue?

Are you comfortable adding debug code to the site to see what $wp_roles is doing there?


tedcumpston

July 26, 2022 at 8:22 am

Looks like I have a few issues to resolve that might help fix this issue. I’ll circle back once I have new details. Thank you for your help thus far!


Tony

  • Support Staff

July 26, 2022 at 8:37 am

No problem 🙂

Viewing 10 reply threads

The support post ‘Error: Invalid argument supplied…’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso