Title: Problem after Transfer
Last modified: December 7, 2021

---

# Problem after Transfer

 *  Resolved [AWOL](https://wordpress.org/support/users/awol/)
 * (@awol)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-after-transfer/)
 * Hi,
    I am using your plugin in a slightly unconventional way, so please bear 
   with me. I have the Transfer shortcode ([mycred_transfer]) on a page, but I have
   used a function in my theme file to put it there, and have used some php to automatically
   fill the amount and the ref in the shortcode – this all works perfectly. The 
   transfer is to an ‘escrow’ account to be held and then passed on if certain things
   occur; however I need to email two users to inform that that the transfer has
   been done; the user making the transfer and another user, which means I have 
   to use something other than the Email Notifications add on to do so. I have a
   function/action in my theme file that does this using wp_mail, which works, and
   I first tried to trigger this using the mycred_transfer_completed action, but
   this didn’t work and I have not been able to figure out why, so that is my first
   query.
 * However I am now trying another way; looking at the html of the transfer shortcode
   I could see that the button to transfer the points did not have a ‘name’ attribute,
   so I added one using javascript (‘transfer’), and then have tried to use an if(
   isset($POST[‘transfer’])) statement to start the sending of the email (as I have
   another button visible on the same page to Cancel the transaction where this 
   method works), but this is not working either! So that is my second query, whether
   there is something in the transfer shortcode/process that is preventing this 
   working?
 * Finally, I would like to ask if there is a way to redirect to another page after
   clicking the ‘OK’ button on the Transaction Completed modal message box rather
   than just reloading the existing page, which is confusing for users – I have 
   tried to dig into the code to find something that I could manipulate this with,
   as well as to alter the appearance of the modal, but I am not having any luck
   with it. Just some key points for me to look for such as where I can find the
   relevant code and if it is actually possible without having to alter core myCred
   files would be a good start.
 * Sorry to be a pain but I have been struggling with this for nearly a week and
   just keep hitting dead ends.
 * P.S. I should add that the transfer goes through, as the on screen notification
   appears, and the user’s balance changes so this is not an issue of it being declined
   or failing.
    -  This topic was modified 4 years, 6 months ago by [AWOL](https://wordpress.org/support/users/awol/).

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [A.Tariq](https://wordpress.org/support/users/arsalantariq/)
 * (@arsalantariq)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-after-transfer/#post-15139833)
 * Hi [@awol](https://wordpress.org/support/users/awol/),
 * Thank you for contacting us, Are you using “Transfer Plus”?
 *  Thread Starter [AWOL](https://wordpress.org/support/users/awol/)
 * (@awol)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-after-transfer/#post-15139957)
 * Hi [@arsalantariq](https://wordpress.org/support/users/arsalantariq/),
    No, I’m
   not using ‘Transfer Plus’, just the standard Transfer shortcode and plugin.
 *  [A.Tariq](https://wordpress.org/support/users/arsalantariq/)
 * (@arsalantariq)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-after-transfer/#post-15147213)
 * Hi [@awol](https://wordpress.org/support/users/awol/),
 * We have forwarded the details to the QA Team we will get back to you once we 
   heard back from them.
 * Thanks!
 *  [A.Tariq](https://wordpress.org/support/users/arsalantariq/)
 * (@arsalantariq)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-after-transfer/#post-15147779)
 * Hi [@awol](https://wordpress.org/support/users/awol/),
 * As we have tested it’s working perfectly fine on our side. Can you please share
   with us the custom code you have used in the functions.php file so we can take
   a look and update you accordingly?
 * This action hook should work `mycred_transfer_completed`.
 * Also, you can not do anything using this if (isset($POST[‘transfer’])).
    Also,
   you can not redirect after a transaction.
 *  Thread Starter [AWOL](https://wordpress.org/support/users/awol/)
 * (@awol)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-after-transfer/#post-15150129)
 * Hi [@arsalantariq](https://wordpress.org/support/users/arsalantariq/),
    OK thank
   you for your reply. I will try my function again with the mycred_transfer_completed
   action hook, and then if it doesn’t succeed this time (I have made some changes)
   I will post here to see if you can help me work out what the problem is. The 
   isset code is not crucial, as it works on the other button, so I can just add
   the wp_mail as an else statement, and if the action hook works as it should I
   don’t need it anyway. Regarding not being able to redirect after a transfer, 
   that is a shame, as I have seen several other people have posted about this; 
   can you explain why it is not possible to either add this to the plugin, or provide
   some code that could be added? I might be able to workaround this, but it would
   obviously be better if it was a standard feature, as it is quite confusing to
   users and could result in duplicate transfers.
 * Finally you didn’t address my other query about the Transaction Completed modal
   message box, and how to adjust the appearance? I would be grateful if you could.
 *  Thread Starter [AWOL](https://wordpress.org/support/users/awol/)
 * (@awol)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/problem-after-transfer/#post-15153672)
 * Hi [@arsalantariq](https://wordpress.org/support/users/arsalantariq/),
 * I have tried again but the function is still not triggered. Below is my code 
   from the functions.php file.
 *     ```
       //Function, Action to send emails after Transfer
           function confirm_result() {
           global $wpdb, $username, $offer, $title, $seller_email, $buyer_name, $buyer_email;
           add_filter( 'wp_mail_content_type', 'wpdocs_set_html_mail_content_type' );
           $seller_subject = "Transfer completed";
           $seller_body = "Dear $username<br>$buyer_name has completed the transfer of $offer to the Bahter escrow account. You can now contact  $buyer_name to make arrangements. Their email address is <a href='mailto:$buyer_email'>$buyer_email</a>. They have also been given your email address.<br>Once you have completed your transaction please visit <a href='mysiteurl/deal-completed/?seller=$username&item=$title'>this link</a> to confirm that it is complete.You may also want to delete your listing if it is a one off item.<br>Thank you.";
           $headers = "From: <admin@mysiteurl>";
           wp_mail( "{$seller_email}", $seller_subject, $seller_body, $headers );
           $buyer_subject = "Transfer complete; instructions to complete transaction for $title";
           $buyer_body = "Dear $buyer_name,<br>Your transfer of $offer is complete. You can now contact $username to make arrangements. Their email address is <a href='mailto:$seller_email'>$seller_email</a>. They have also been given your email address.<br>Once you have completed your transaction please visit <a href='mysiteurl/deal-completed/?buyer=$buyer_name&item=$title'>this link</a> to confirm that it is complete.<br>Thank you.";
           wp_mail( "{$buyer_email}", $buyer_subject, $buyer_body, $headers );
   
           // Reset content-type to avoid conflicts
       remove_filter( 'wp_mail_content_type', 'wpdocs_set_html_mail_content_type' );
            }
       add_action ('mycred_transfer_completed', 'confirm_result');
       ```
   
 * I have tested the wp_mail and that works (as I mentioned before there is a Cancel
   button on the same page which also sends an email). I don’t see anything in my
   code that would cause an issue, but if you can I’ll be glad to implement any 
   suggestion. It just seems that on my site the ‘mycred_transfer_completed’ is 
   not firing, even though the transfers are going through and being notified on
   screen.
 *  [A.Tariq](https://wordpress.org/support/users/arsalantariq/)
 * (@arsalantariq)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/problem-after-transfer/#post-15161288)
 * Hi [@awol](https://wordpress.org/support/users/awol/),
 * Are you initializing There variables?
 *     ```
       global $wpdb, $username, $offer, $title, $seller_email, $buyer_name, $buyer_email;
       ```
   
 * Because the action hook `mycred_transfer_completed` returns 4 paramerters Transfer
   ID, Request, Setttings, And Object, By accessing these 4 parameters you can easily
   find Sender and Reciever’s ID, Then you can access User names.
 * After a successful transaction redirect to desired page, We’ve added this into
   our roadmap, We’ll release the feature in upcoming release.
 *  Thread Starter [AWOL](https://wordpress.org/support/users/awol/)
 * (@awol)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/problem-after-transfer/#post-15171912)
 * Hi [@arsalantariq](https://wordpress.org/support/users/arsalantariq/),
    Thanks
   but the variables are not the problem; I have tested all of that in another way.
   The problem is the `mycred_transfer_completed` not triggering the action at all.
   That is why I tried to find another way to achieve it, with the isset() code 
   I mentioned. Please help me understand why `mycred_transfer_completed` isn’t 
   working or how I can investigate it, or provide me with an alternative if possible?
 * And thank you for planning to add the redirect, but I should point out that it
   should be after the modal message is dismissed by the user, whether successful
   or not – the confusing part is that the user is currently presented with the 
   transfer page again once the modal is dismissed with the ‘OK’ button. This will
   almost certainly lead to repeated transfers, as people think that the transaction
   has not been successful even though the modal appears and is dismissed; it leads
   to uncertainty.
 *  [A.Tariq](https://wordpress.org/support/users/arsalantariq/)
 * (@arsalantariq)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/problem-after-transfer/#post-15180954)
 * Hi [@awol](https://wordpress.org/support/users/awol/),
 * As we have tested it on our staging environment the hook is successfully triggered.
   We used `var_dump`and `die`, Which are used for debugging.
 * So this must be related to your environment as no one reported this issue till
   now.
 * **[Screenshot 1](https://www.awesomescreenshot.com/image/18862141?key=afb2027b392bb1fe2ac855341953f79f)**:
   **
   [Screenshot 2](https://www.awesomescreenshot.com/image/18862110?key=9118daed07bd6f470285f3607eafa49c)**
    -  This reply was modified 4 years, 5 months ago by [A.Tariq](https://wordpress.org/support/users/arsalantariq/).

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Problem after Transfer’ is closed to new replies.

 * ![](https://ps.w.org/mycred/assets/icon-128x128.gif?rev=3512531)
 * [Points Management System For Gamification, Ranks, Badges, and Loyalty Rewards Program - myCred](https://wordpress.org/plugins/mycred/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mycred/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mycred/)
 * [Active Topics](https://wordpress.org/support/plugin/mycred/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mycred/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mycred/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [A.Tariq](https://wordpress.org/support/users/arsalantariq/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/problem-after-transfer/#post-15180954)
 * Status: resolved