WordPress.org

Forums

PayPal Framework
PayPal Donate Button (4 posts)

  1. br3nt
    Member
    Posted 10 months ago #

    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/

  2. Aaron D. Campbell
    Member
    Plugin Author

    Posted 10 months ago #

    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.

  3. br3nt
    Member
    Posted 10 months ago #

    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.

  4. br3nt
    Member
    Posted 10 months ago #

    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.

Reply

You must log in to post.

About this Plugin

  • PayPal Framework
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.