Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.45 KB | None | 0 0
  1. <?php
  2. /*
  3. Plugin Name: Site plugin for genevaphotoclub.com
  4. Description: Site specific code for genevaphotoclub.com
  5. */
  6. /* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */
  7.  
  8.  
  9. //* Allow state or province field to be a text field and make it optional
  10. add_filter( 'FHEE__EE_Billing_Attendee_Info_Form__state_field', 'billing_locale_text_field', 10, 1 );
  11. //add_filter( 'FHEE__EE_Billing_Attendee_Info_Form__country_field', 'billing_locale_text_field', 10, 1 );
  12. function billing_locale_text_field( $original_field ) {
  13. return new EE_Text_Input( array( 'required' => false, 'html_class' => 'ee-billing-qstn'));
  14. }
  15.  
  16. function ee_populate_from_attendee_information_or_use_default( $autofill_data, $attendee ) {
  17. if( $attendee instanceof EE_Attendee) {
  18. if( $attendee->state_ID() ) {
  19. $autofill_data[ 'state' ] = $attendee->state_name();
  20. } else {
  21. $autofill_data[ 'state' ] = '';
  22. }
  23. if( $attendee->country_ID() ) {
  24. $autofill_data[ 'country' ] = $attendee->country_name();
  25. } else {
  26. $autofill_data[ 'country' ] = 'CH';
  27. }
  28. }
  29. return $autofill_data;
  30. }
  31. add_filter( 'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee', 'ee_populate_from_attendee_information_or_use_default', 10, 2 );
  32.  
  33.  
  34. // Register Now button text
  35. function ee_register_now_button() {
  36. return 'Register · S\'inscrire';
  37. }
  38.  
  39. add_filter ('FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', 'ee_register_now_button');
  40.  
  41. // Finalize Registration button text
  42. function ee_modify_button_text( $submit_button_text, EE_Checkout $checkout ) {
  43. if ( ! $checkout instanceof EE_Checkout || ! $checkout->current_step instanceof EE_SPCO_Reg_Step || ! $checkout->next_step instanceof EE_SPCO_Reg_Step ) {
  44. return $submit_button_text;
  45. }
  46. if ( $checkout->next_step->slug() == 'finalize_registration' ) {
  47. $submit_button_text = 'Finalize registration · Finaliser l\'inscription';
  48. }
  49. return $submit_button_text;
  50. }
  51. add_filter( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_modify_button_text', 10, 2);
  52.  
  53.  
  54. // promotion button text
  55. function ee_modify_promotions_button_text() {
  56. return 'Submit Promotion Code · Soumettre le code de Promotion';
  57. }
  58. add_filter( 'FHEE__EED_Promotions___add_promotions_form_inputs__ee_promotion_code_submit__default', 'ee_modify_promotions_button_text' );
  59.  
  60.  
  61. // Proceed to Payment Options text
  62. function ee_proceed_to_button( $submit_button_text, EE_Checkout $checkout ) {
  63. if ( ! $checkout instanceof EE_Checkout || ! $checkout->current_step instanceof EE_SPCO_Reg_Step || ! $checkout->next_step instanceof EE_SPCO_Reg_Step ) {
  64. return $submit_button_text;
  65. }
  66. if ( $checkout->next_step->slug() == 'payment_options' ) {
  67. $submit_button_text = 'Proceed to Payment · Procéder au Paiement';
  68. }
  69. return $submit_button_text;
  70. }
  71.  
  72. add_filter ( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_proceed_to_button', 10, 2 );
  73.  
  74.  
  75. // general text strings
  76. function ee_general_filter_gettext( $translated, $original, $domain ) {
  77.  
  78. // This is an array of original strings
  79. // and what they should be replaced with
  80. $strings = array(
  81. 'Please Select Your Method of Payment' => 'Please Select Your Method of Payment &middot; Merci de sélectionner votre mode de règlement',
  82. 'Important information regarding your payment' => '',
  83. 'First Name' => 'First name · Prénom',
  84. 'Last Name' => 'Last name · Nom de famille',
  85. 'Personal Information' => 'Personal Information · Vos données personnelles',
  86. 'Registrations:' => 'Number of Registrations · Nombre d\'inscriptions',
  87. 'Name and Description' => 'Course Name · Nom de Cours:',
  88. 'Price' => 'Price · Prix',
  89. 'Qty' => 'Qty · Qté',
  90. 'Total' => 'Total',
  91. 'Line Item' => '',
  92. 'Address' => 'Address · Adresse',
  93. 'City' => 'City · Ville',
  94. 'Country' => 'Country · Pays',
  95. 'Zip' => 'Postal Code · Code Postale',
  96. 'Phone' => 'Phone · Téléphone',
  97. // Add some more strings here
  98. );
  99.  
  100. // See if the current string is in the $strings array
  101. // If so, replace its translation
  102. if ( isset( $strings[$original] ) ) {
  103. // This accomplishes the same thing as __()
  104. // but without running it through the filter again
  105. $translations = get_translations_for_domain( $domain );
  106. $translated = $translations->translate( $strings[$original] );
  107. }
  108.  
  109. return $translated;
  110. }
  111.  
  112. add_filter( 'gettext', 'ee_general_filter_gettext', 10, 3 );
  113.  
  114. //* Add instructor name to the CSV Download
  115.  
  116. add_filter( 'FHEE__EE_Export__report_registrations__reg_csv_array', 'espresso_add_author_to_report', 10, 2);
  117. function espresso_add_author_to_report( $reg_csv_array, $reg_row ) {
  118. $event_id = $reg_row['Registration.EVT_ID'];
  119. $event = EEM_Event::instance()->get_one_by_ID( $event_id );
  120. if ( $event instanceof EE_Event ) {
  121. $post_author = get_post_field( 'post_author', $event_id );
  122. $author_info = get_userdata( $post_author );
  123. $reg_csv_array['Author'] = $author_info->last_name . ", " . $author_info->first_name;
  124. }
  125. return $reg_csv_array;
  126. }
  127.  
  128. //* Disable email match forced login - EE4 WP User Integration
  129.  
  130. add_filter( 'EED_WP_Users_SPCO__verify_user_access__perform_email_user_match_check', 'jf_ee_wp_users_remove_email_user_match_check' );
  131. function jf_ee_wp_users_remove_email_user_match_check() {
  132. if ( ! is_user_logged_in() ) {
  133. return false;
  134. } else {
  135. return true;
  136. }
  137. }
  138.  
  139. /* Stop Adding Functions */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement