-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
604 additions
and
759 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Generate Translations | ||
on: workflow_dispatch | ||
jobs: | ||
generate-translations: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: WordPress POT/PO/MO Generator | ||
uses: strangerstudios/action-wp-pot-po-mo-generator@main | ||
with: | ||
generate_pot: 1 | ||
generate_po: 1 | ||
generate_mo: 1 | ||
generate_lang_packs: 1 | ||
merge_changes: 1 | ||
headers: '{"Report-Msgid-Bugs-To":"[email protected]","Last-Translator":"Paid Memberships Pro <[email protected]>","Language-Team":"Paid Memberships Pro <[email protected]>"}' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Sync labels | ||
on: | ||
# You can run this with every type of event, but it's better to run it only when you actually need it. | ||
workflow_dispatch: | ||
|
||
jobs: | ||
labels: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: strangerstudios/label-sync@v2 | ||
with: | ||
# If you want to use a source repo, you can put is name here (only the owner/repo format is accepted) | ||
source-repo: strangerstudios/paid-memberships-pro | ||
|
||
# If you want to delete any additional label, set this to true | ||
delete-other-labels: true | ||
|
||
#If you want the action just to show you the preview of the changes, without actually editing the labels, set this to tru | ||
dry-run: false | ||
|
||
# You can change the token used to change the labels, this is the default one | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
<?php | ||
|
||
/** | ||
* Add a shipping address field to the checkout page with "sameas" checkbox. | ||
* | ||
* @deprecated 1.2 | ||
*/ | ||
function pmproship_pmpro_checkout_boxes() { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
|
||
/** | ||
* Get fields on checkout page. | ||
* | ||
* @deprecated 1.2 | ||
*/ | ||
function pmproship_pmpro_checkout_preheader() { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
/** | ||
* Choose which hook to use to update user meta values. | ||
* For PayPal Standard, 2Checkout, CCBill, and Payfast, we need to | ||
* run this code before we redirect away. | ||
* For other gateways, including onsite gateways and PayPal express, | ||
* we run this code after checkout. | ||
* | ||
* @deprecated 1.2 | ||
*/ | ||
function pmproship_pmpro_checkout_preheader_check_gateway() { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
/** | ||
* Update a user meta values. | ||
* | ||
* @deprecated 1.2 | ||
*/ | ||
function pmproship_save_shipping_to_usermeta($user_id) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
|
||
/** | ||
* Show the shipping address in the profile | ||
* | ||
* @deprecated 1.2 | ||
*/ | ||
function pmproship_show_extra_profile_fields( $user ) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
/** | ||
* Show the shipping address in the frontend profile | ||
* | ||
* @deprecated 1.2 | ||
*/ | ||
function pmproship_show_extra_frontend_profile_fields( $user ) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
/** | ||
* Save profile fields | ||
* | ||
* @deprecated 1.2 | ||
*/ | ||
function pmproship_save_extra_profile_fields( $user_id ) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
/** | ||
* These bits are required for PayPal Express | ||
* Save fields to session so we can update them | ||
* after returning from PayPal | ||
* | ||
* @deprecated 1.2 | ||
*/ | ||
function pmproship_save_shipping_to_session() { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
/** | ||
* Are one of the shipping address data fields set? | ||
* | ||
* @deprecated 1.2 | ||
* | ||
* @param array $object | ||
* | ||
* @return bool | ||
*/ | ||
function pmproship_is_shipping_set( $object = NULL ) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
/** | ||
* Require the shipping fields (optional) | ||
* | ||
* @deprecated 1.2 | ||
*/ | ||
function pmproship_pmpro_registration_checks( $okay ) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
/** | ||
* Use a dropdown for state in the billing fields | ||
* | ||
* @deprecated 1.2 | ||
*/ | ||
function pmproship_pmpro_state_dropdowns( $use ) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
/** | ||
* Add column to export | ||
*/ | ||
//columns | ||
function pmproship_pmpro_members_list_csv_extra_columns( $columns ) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
|
||
//call backs | ||
function pmproship_extra_column_sfirstname( $user ) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
function pmproship_extra_column_slastname( $user ) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
function pmproship_extra_column_saddress1( $user ) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
function pmproship_extra_column_saddress2( $user ) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
function pmproship_extra_column_scity( $user ) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
function pmproship_extra_column_sstate( $user ) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
function pmproship_extra_column_szipcode( $user ) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
|
||
function pmproship_extra_column_sphone( $user ) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
function pmproship_extra_column_scountry( $user ) { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} | ||
|
||
/** | ||
* Actually hide/disable shipping address for these levels. | ||
* | ||
* @deprecated 1.2 | ||
*/ | ||
function pmproship_hide_shipping() { | ||
_deprecated_function( __FUNCTION__, '1.2', 'pmproship_add_user_fields' ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,39 @@ | ||
/** | ||
* Copyright (c) 2017 - Stranger Studios, LLC | ||
*/ | ||
|
||
var pmpro_shipping = {}; | ||
|
||
jQuery(document).ready(function($){ | ||
"use strict"; | ||
|
||
pmpro_shipping = { | ||
init: function() { | ||
|
||
this.field_names = [ 'firstname', 'lastname', 'address1', 'address2', 'phone', 'country', 'city', 'state', 'zipcode' ]; | ||
this.sameas_checkbox = $('#sameasbilling'); | ||
this.fields = $('#shipping-fields'); | ||
this.show_sameas_timer = null; | ||
|
||
var self = this; | ||
|
||
//hide/show shipping fields and copy when clicking sameas | ||
self.sameas_checkbox.unbind('change').on('change', function() { | ||
//maybe copy | ||
self.maybe_copy_data( this ); | ||
}); | ||
|
||
//hide the sameas button if the billing address is not visible | ||
self.checkBillingAddressVisibilityForSameAsCheckbox(); | ||
}, | ||
maybe_copy_data: function( element ) { | ||
if ( $( '#pmpro_billing_address_fields' ).css( 'display' ) !== 'none' ) { | ||
$( '#pmproship_same_billing_address_div' ).show(); | ||
function pmproship_update_shipping_fields() { | ||
// If the "same as billing" checkbox is checked, hide the shipping fields and copy the values. Otherwise, show them. | ||
if ( $( '#pmproship_same_billing_address' ).is( ':checked' ) ) { | ||
$( '#pmpro_checkout_box-shipping-address .pmpro_checkout-field-text, #pmpro_checkout_box-shipping-address .pmpro_checkout-field-select' ).each( function( index, element ) { | ||
$( element ).hide(); | ||
} ); | ||
|
||
var self = this; | ||
|
||
if (element.checked) { | ||
//hide the fields | ||
self.fields.hide(); | ||
|
||
// Integrate with State dropdown, convert #sstate to text input. | ||
if ( $( '#bcountry.crs-country' ).length > 0 ) { | ||
$('#sstate').replaceWith( '<input type="text" id="sstate" name="sstate"></input>'); | ||
} | ||
// Copy the billing fields to the shipping fields. | ||
$( '#pmpro_billing_address_fields input, #pmpro_billing_address_fields select' ).each( function( index, element ) { | ||
// Get the name of the shipping field. | ||
let shipping_field_name = element.name; | ||
|
||
//copy the fields | ||
$.each( self.field_names, function( index, field_name ) { | ||
$( '#s' + field_name ).val( $('#b' + field_name ).val() ); // Set shipping field equal to each billing field. | ||
}); | ||
} else { | ||
//show the fields | ||
self.fields.show(); | ||
} | ||
}, | ||
checkBillingAddressVisibilityForSameAsCheckbox: function() { | ||
var baddress = $('#baddress1'); | ||
var pmpro_shipping_address_fields = $('#pmpro_shipping_address_fields'); | ||
|
||
var self = this; | ||
|
||
if(this.sameas_checkbox.is(':checked')) { | ||
this.fields.hide(); | ||
} | ||
// Replace the first character with 'pmpro_s' to get the name of the shipping field. | ||
shipping_field_name = 'pmpro_s' + shipping_field_name.substr( 1 ); | ||
|
||
if(baddress.length && baddress.is(':visible')) { | ||
$('#sameasbilling_wrapper').show(); | ||
} | ||
else if (pmpro_shipping_address_fields.is(':visible')) | ||
{ | ||
this.sameas_checkbox.attr('checked', false); | ||
$('#sameasbilling_wrapper').hide(); | ||
this.fields.show(); | ||
// Set the value of the shipping field to the value of the billing field. | ||
$( '#' + shipping_field_name ).val( element.value ); | ||
} ); | ||
} else { | ||
$( '#pmpro_checkout_box-shipping-address .pmpro_checkout-field-text, #pmpro_checkout_box-shipping-address .pmpro_checkout-field-select' ).each( function( index, element ) { | ||
$( element ).show(); | ||
} ); | ||
} | ||
//check again in .2 seconds | ||
this.show_sameas_timer = setTimeout(function(){self.checkBillingAddressVisibilityForSameAsCheckbox();}, 200); | ||
} | ||
}; | ||
} | ||
|
||
pmpro_shipping.init(); | ||
// Make sure that the shipping fields are updated when the page loads, when the "same as billing" checkbox is clicked, and when the submit button is clicked. | ||
pmproship_update_shipping_fields(); | ||
$( '#pmproship_same_billing_address' ).on( 'change', pmproship_update_shipping_fields ); | ||
$( '#pmpro_btn-submit' ).on( 'click', pmproship_update_shipping_fields ); | ||
} | ||
}); |
Binary file not shown.
Oops, something went wrong.