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

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

@navigatrum

Description

@navigatrum

<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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions