gkaroly

Oklevél

May 3rd, 2019
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.42 KB | None | 0 0
  1. <?php
  2. /**
  3. * Plugin Name: Tegyjot Diploma
  4. */
  5.  
  6. if ( !function_exists( 'add_action' ) ) {
  7. echo "Nana! Csak egy plugin vagyok, ne nyiss meg direktben!";
  8. exit;
  9. }
  10.  
  11. global $post;
  12. $lang = get_bloginfo('language');
  13.  
  14. function oklevel($donation_id, $donation_processor){
  15. $campaign = $donation_processor->get_campaign();
  16. $campaign_id = $campaign->__get('ID');
  17. $file="test.txt";
  18. setlocale(LC_ALL,'hungarian');
  19.  
  20. $content_hu="
  21. <p style=\"text-align: center;\">Köszönet és elismerés</p>
  22.  
  23. <h1 style=\"text-align: center;\">".$_POST['last_name']." ".$_POST['first_name']."</h1>
  24. <p style=\"text-align: center;\">részére</p>
  25. <p style=\"text-align: center;\">hogy támogatta</p>
  26.  
  27. <h2 style=\"text-align: center;\">".get_field('name', $_POST['campaign_id'])."</h2>
  28. <p style=\"text-align: center;\">gyűjtését.</p>
  29. <p><br =><br />Kelt: Ózd, ".date("Y. m. d.")."
  30.  
  31. ".get_field('name', $_POST['campaign_id'])." és családja nevében is köszönettel:</p>
  32.  
  33. <p style=\"text-align: right;\">Ganyi Károly,<br />
  34. Tóthné Lilla Hedvig<br />
  35. Tóth István<br />
  36. Pájerné Somogyi Szilvia<br />
  37. Kapaló Éva<br />
  38. Ráski Eszter Anna<br />
  39. Cseke Andrásné </p>
  40.  
  41. <p style=\"text-align: right;\">a Tégy jót! csapata</p>
  42. <table style=\"width: 100%;\">
  43. <tbody>
  44. <tr>
  45. <td style=\"width: 33.3%;\"></td>
  46. <td><img src=\"https://tegyjot.hu/wp-content/uploads/2017/06/thanks.png\" width=\"280\" height=\"280\" /></td>
  47. <td style=\"width: 33.3%;\"></td>
  48. </tr>
  49. </tbody>
  50. </table>";
  51.  
  52. $content_en="
  53. <p style=\"text-align: center;\">thank you and appreciate for</p>
  54.  
  55. <h1 style=\"text-align: center;\">".$_POST['last_name']." ".$_POST['first_name']."</h1>
  56. <p style=\"text-align: center;\">that support</p>
  57.  
  58. <h2 style=\"text-align: center;\">".get_field('name', $_POST['campaign_id'])."</h2>
  59. <p style=\"text-align: center;\">donation.</p>
  60. <p><br =><br />Kelt: Ózd, ".date("Y. m. d.")."
  61.  
  62. <p>Thank you also in the name of ".get_field('name', $_POST['campaign_id'])."</p>
  63.  
  64.  
  65. <p style=\"text-align: right;\">Károly Ganyi,<br />
  66. Lilla Hedvig Tóthné<br />
  67. István Tóth<br />
  68. Szilvia Somogyi Pájerné<br />
  69. Éva Kapaló<br />
  70. Eszter Anna Ráski
  71. Andrásné Cseke</p>
  72.  
  73. <p style=\"text-align: right;\">The Tégy jót!® team</p>
  74. <table style=\"width: 100%;\">
  75. <tbody>
  76. <tr>
  77. <td style=\"width: 33.3%;\"></td>
  78. <td><img src=\"https://tegyjot.hu/wp-content/uploads/2017/06/thanks_en.png\" width=\"280\" height=\"280\" /></td>
  79. <td style=\"width: 33.3%;\"></td>
  80. </tr>
  81. </tbody>
  82. </table>";
  83.  
  84. //if ($_POST['donation_amount'] >= 10000 OR $_POST['custom_donation_amount'] >= 10000) {
  85. if ($_POST['email'] !== "[email protected]") {
  86. if (get_bloginfo('language') == "hu") {
  87. $post_ID = wp_insert_post(array('post_title'=>get_field('name', $_POST['campaign_id'])." - ".$_POST['last_name']." ".$_POST['first_name'], 'post_type'=>'diploma', 'post_content'=>$content_hu, 'post_status' => 'publish'));
  88. } else {
  89. $post_ID_en = wp_insert_post(array('post_title'=>get_field('name', $_POST['campaign_id'])." - ".$_POST['last_name']." ".$_POST['first_name'], 'post_type'=>'diploma', 'post_content'=>$content_en, 'post_status' => 'publish'));
  90. }
  91. }
  92. //}
  93.  
  94. //file_put_contents($file, $post_ID, FILE_APPEND | LOCK_EX);
  95.  
  96. $sikeres_title_hu="Sikeres támogatás";
  97. $sikeres_hu="[vc_row][vc_column][vc_message color=\"success\" message_box_color=\"success\" icon_fontawesome=\"fa fa-check\"]Sikeres támogatás.[/vc_message][/vc_column][/vc_row][vc_row][vc_column][vc_column_text css_animation=\"fadeIn\"]Köszönjük a támogatást. A megadott email címre elküldtük a banki utaláshoz szükséges adatokat.
  98.  
  99. További kérdés esetén a <a href=\"mailto:[email protected]\">[email protected]</a> email címen állunk szíves rendelkezésére.[/vc_column_text][/vc_column][/vc_row]";
  100.  
  101. //if ($_POST['donation_amount'] >= 10000 OR $_POST['custom_donation_amount'] >= 10000) {
  102. $sikeres_hu.="[vc_row][vc_column][vc_message message_box_color=\"turquoise\" icon_fontawesome=\"fa fa-file-pdf-o\"]<a href=\"?pdf=".$post_ID."\">Kattintson ide az oklevél letöltéséhez!</a>[/vc_message][/vc_column][/vc_row]";
  103. //}
  104. if ($_POST['email'] !== "[email protected]") {
  105.  
  106. // Update post 37
  107. $my_post = array(
  108. 'ID' => 2238,
  109. 'post_title' => $sikeres_title_hu,
  110. 'post_content' => $sikeres_hu,
  111. );
  112.  
  113. // Update the post into the database
  114. wp_update_post( $my_post );
  115.  
  116. // Update Sikeres támogatás
  117. }
  118.  
  119. }
  120. add_action('charitable_after_save_donation','oklevel',97,2);
  121.  
  122. ?>
Advertisement
Add Comment
Please, Sign In to add comment