• Hi Aaron

    I’m making a donation plugin that uses the IPN listener feature of your plugin. A donate button uses PayPal ID or email address and I’m wanting to add a field on the PayPal options page of your plugin to store it.

    Do you know how I might achieve this?

    Cheers,
    Brent

    https://wordpress.org/plugins/paypal-framework/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Aaron D. Campbell

    (@aaroncampbell)

    It doesn’t look like there are any actions in there for you to do that. It’s something I can add but honestly I’m pretty busy right now so I don’t know exactly when I can get it done.

    Thread Starter br3nt

    (@br3nt)

    Hey Aaron,

    I worked out how to do it by following this tutorial.

    Here is the code I ended up with:

    add_action('admin_init', function() {
      register_setting($wpPayPalFramework->_optionsGroup, 'sfr_paypal_id', function($val) {
        return trim(wp_strip_all_tags($val, true));
      });
      add_settings_section('sfr_paypal_id_section', 'PayPal ID', function() { return 'PayPal ID for use in donation button'; }, 'PayPalFramework');
      add_settings_field('sfr_paypal_id', 'PayPal ID or email', 'sfr_paypal_id_input', 'PayPalFramework', 'sfr_paypal_id_section');
    });
    
    function sfr_paypal_id_input() {
      $paypal_id = get_option('sfr_paypal_id');
      echo "<input id='sfr_paypal_id_text' name='sfr_paypal_id' size='40' type='text' value='{$paypal_id}' />";
    }

    Thanks for your plugin. It has made things many times simpler.

    Thread Starter br3nt

    (@br3nt)

    Update: The code I posted above doesn’t work. It displays the input on the PayPal settings page, but the the value doesn’t get saved. I haven’t discovered the reason why yet.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PayPal Donate Button’ is closed to new replies.