WordPress.org

Ready to get started?Download WordPress

Forums

PayPal Donations
[resolved] Weird Theme Error (5 posts)

  1. genesteinberg
    Member
    Posted 1 year ago #

    Since version 1.7, I have been unable to use this plugin. I get this message where the button is supposed to appear:

    Fatal error: Class 'paypal_donations' not found in /home/technigh/public_html/wp-content/themes/technightowl/single.php on line 47

    The section referenced has something inserted by a theme designer with whom I have no present contact.

    <?php
    $paypal = new paypal_donations();
    $atts='';
    echo $paypal->paypal_shortcode($atts);
    ?>

    What do I change to get your shortcode to function?

    Peace,
    Gene

    http://wordpress.org/extend/plugins/paypal-donations/

  2. Johan Steen
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Gene,

    The class has changed name since v1.7, so it's now called PayPalDonations() instead of paypal_donations(). And it's now a Singleton class, so if it's already been initiated (which it has by the plugin system, it shouldn't be started with a new)

    If the theme is calling the plugin directly you need to modify the code you posted above slightly. Also the method to generate the shortcode has changed name from paypal_shortcode() to paypalShortcode().

    Modifying your block of code to this, should do the trick for you:

    <?php
        $paypal = PayPalDonations::getInstance();
        $atts='';
        echo $paypal->paypalShortcode($atts);
    ?>

    Cheers,
    Johan

  3. genesteinberg
    Member
    Posted 1 year ago #

    Maybe, but now it says:

    Fatal error: Call to private PayPalDonations::__construct() from invalid context in /home/technigh/public_html/wp-content/themes/technightowl/single.php on line 47

    Peace,
    Gene

  4. Johan Steen
    Member
    Plugin Author

    Posted 1 year ago #

    Gene, I just modified my reply above, with a code change. As I just realized that new won't work anymore either when calling the plugin code from outside the plugin. So try the code above now.

    Cheers,
    Johan

  5. genesteinberg
    Member
    Posted 1 year ago #

    OK, we're good now.

    Thanks.

    Peace,
    Gene

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.