sailthru / sailthru-wordpress-plugin

Wordpress Plugin
6 stars 23 forks source link

Shortcode signup fails if customfields are not set. #92

Open tedmsuperstar opened 3 years ago

tedmsuperstar commented 3 years ago

When I try to sign up through the shortcode with any email address, the list is updated on the sailthru side, but the server throws a 500 and the user doesn't see a "Thank You" message.

$customfields is initialized here: https://github.com/sailthru/sailthru-wordpress-plugin/blob/master/widget.subscribe.php#L122

In wordpress, the get_option call will return false if the option has never been set. This is the case if no custom options have ever been set. (It will return an array if the options have been set but then deleted. This cause doesn't cause a 500.)

the signature of the function should_send_welcome_template requires $customfields to be an array, so it fails on this line and throws a 500 if the wordpress user has never configured a custom field https://github.com/sailthru/sailthru-wordpress-plugin/blob/master/widget.subscribe.php#L431