Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter shubham jain

    (@engshubham2013)

    I have made hook in this class – “class-donation-button-paypal-listner.php”

    public function ipn_response_postmeta_handler($post_id, $posted) {
    
           foreach ($posted as $metakey => $metavalue) {
                update_post_meta($post_id, $metakey, $metavalue);
            }
            /* Start Custom Code */
               do_action('custom_after_do_payment', $post_id);
            /* End  Custom Code */
        }

    under the custom code comment and wrote a function in mytheme file – “functions.php”

    // Paypal Submit By
    function callback_payment_submit_by($post_id){
    	wp_update_post(array('ID' => $post_id, 'post_author' => get_current_user_id()));
    }
    add_action('custom_after_do_payment', 'callback_payment_submit_by');

    Everything is run, but – ” get_current_user_id() ” function return 0 (Zero) value.

    Plugin Author mbj-webdevelopment

    (@mbj-webdevelopment)

    Hey Shubham,

    get_current_user_id() return 0 value because you are calling function before init is loaded.

    I have another suggestion for you:

    pass custom <input type=’hidden’ value=”<?php echo get_current_user_id(); ?>”> in the donation form,

    you will get this value in the PayPal IPN response.

    Let me know if any.

    Thread Starter shubham jain

    (@engshubham2013)

    Thanks for your answer, i did it and it’s working.

    Thanks,
    Shubham

    Plugin Author mbj-webdevelopment

    (@mbj-webdevelopment)

    If you have a moment to leave a review for the plugin that would be great!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Insert the current user id’ is closed to new replies.