Skip to content
This repository has been archived by the owner on Aug 27, 2018. It is now read-only.

Undefined variable: icon_url, in WebPush_Admin::tools #332

Open
navigatrum opened this issue Dec 23, 2017 · 0 comments
Open

Undefined variable: icon_url, in WebPush_Admin::tools #332

navigatrum opened this issue Dec 23, 2017 · 0 comments

Comments

@navigatrum
Copy link
Contributor

<input type="hidden" id="webpush_icon_custom" name="webpush_icon_custom" value="<?php echo $icon_url; ?>" />

Notice: Undefined variable: icon_url in ...plugins/web-push/wp-web-push-admin.php on line 567

If I'm not going wrong it can be fixed like so:

<input type="hidden" id="webpush_icon_custom" name="webpush_icon_custom" value="<?php echo $icon_option !== 'blog_icon' && $icon_option !== '' && $icon_option !== 'post_icon' ? $icon_option : ''; ?>" />

Or if it's better to be consistent with the options method at lines 311-314:

$icon_url = '';
if ($icon_option !== 'blog_icon' && $icon_option !== '' && $icon_option !== 'post_icon') {
$icon_url = $icon_option;
}

...adding the same $icon_url definition to the tools method, maybe at line 533:

$title_option = get_option('webpush_title');
$icon_option = get_option('webpush_icon');

Note also that the options method - at line 360 - , and eventually the tools method implementing the same treatment of $icon_url - at line 566 - could be changed from:

<label><input type="radio" name="webpush_icon" value="custom" <?php echo $icon_option !== 'blog_icon' && $icon_option !== '' && $icon_option !== 'post_icon' ? 'checked' : ''; ?> /> <?php _e('Custom:'); ?></label>

and:
<label><input type="radio" name="webpush_icon" value="custom" <?php echo $icon_option !== 'blog_icon' && $icon_option !== '' && $icon_option !== 'post_icon' ? 'checked' : ''; ?> /> <?php _e('Custom:'); ?></label>

to:
<label><input type="radio" name="webpush_icon" value="custom" <?php echo $icon_url ? 'checked' : ''; ?> /> <?php _e('Custom:'); ?></label>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant