Mautic Community Forums

About that Wordpress plugin...

Hi!



Thanks for the code here: https://www.mautic.org/community/index.php/1022-wordpress-plugin-what-does-it-do/



I finally got around to trying this on a new site where I want WordPress users to be added to Mautic - I get this error message:



Warning: Invalid argument supplied for foreach() in [mysite]/public_html/wp-content/plugins/wp-mautic/wpmautic.php on line 55



My PHP skillz are insufficently awesome to work out what’s wrong - any ideas?



Thanks!

Hi!

Thanks for the code here: https://www.mautic.org/community/index.php/1022-wordpress-plugin-what-does-it-do/

I finally got around to trying this on a new site where I want WordPress users to be added to Mautic - I get this error message:

Warning: Invalid argument supplied for foreach() in [mysite]/public_html/wp-content/plugins/wp-mautic/wpmautic.php on line 55

My PHP skillz are insufficently awesome to work out what’s wrong - any ideas?

Thanks!

Ok, I think I’ve figured it out - $user_query would be null if no user is logged in.

Changed it to:

$user_query = wpmautic_get_user_query(); if (!is_null($user_query)){ foreach($user_query as $key => $val){ $url_query[$key]=$val; } }

This seems to work, unless I’ve unleashed a horde of nastier bugs…