Forums

[Plugin: Add to Any: Subscribe Button] I get an error! (2 posts)

  1. ThorHammer
    Member
    Posted 2 years ago #

    I plaved the code in my theme within the loop and got the button displayed. But I also got this error message:

    Notice: Undefined variable: output_later in /customers/myplace.com/myplace.com/httpd.www/wp-content/plugins/add-to-any/add-to-any.php on line 103
    
    Notice: Undefined variable: output_later in /customers/myplace.com/myplace.com/httpd.www/wp-content/plugins/add-to-any/add-to-any.php on line 191

    How to get rid of these errors?

    http://wordpress.org/extend/plugins/add-to-any-subscribe/

  2. scott@printelectric.com
    Member
    Posted 1 year ago #

    Hi. I realize this is an old post - hopefully you've fixed or blown this off by now - but the easy fix for me was to check that the variable is set before referencing it. This involved editing the PHP code for the plug-in, so if you're uncomfortable with that, stop reading now. But it's actually a pretty easy fix:

    ORIGINAL CODE:
    if( $button_fname == 'favicon.png' || $button_fname == 'share_16_16.png' ) {

    EDIT
    if ( (isset($button_fname)) && ($button_fname == 'favicon.png' || $button_fname == 'share_16_16.png' ) ) {

    The idea is

    if ( (variable is set) AND ( condition1 OR condition2 ) ) {
    ...do something
    }

    The error is occurring bc. PHP is trying to check the value of a variable that does not exist.

    Of course the easiest fix is to turn off debug mode in WordPress ;)

Topic Closed

This topic has been closed to new replies.

About this Topic