Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for #1579 and #1580 #1582

Merged
merged 3 commits into from
Mar 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions includes/admin/upgrades/upgrade-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function give_do_automatic_upgrades() {
case version_compare( $give_version, '1.7', '<' ) :
give_v17_upgrades();
$did_upgrade = true;
break;
break;

case version_compare( $give_version, '1.8', '<' ) :
give_v18_upgrades();
Expand Down Expand Up @@ -138,7 +138,7 @@ function give_show_upgrade_notices() {
$upgrade_links.on( 'click', function(e){
e.preventDefault();

if( ! window.confirm( give_vars.upgrade_confirmation ) ) {
if( ! window.confirm( '<?php _e( 'Please make sure to create a database backup before initiating the upgrade.', 'give' ); ?>' ) ) {
return;
}

Expand Down Expand Up @@ -707,7 +707,6 @@ function give_v18_upgrades_form_metadata() {
)
);


if ( $forms->have_posts() ) {
while ( $forms->have_posts() ) {
$forms->the_post();
Expand All @@ -723,13 +722,25 @@ function give_v18_upgrades_form_metadata() {
$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
update_post_meta( get_the_ID(), '_give_content_placement', $field_value );
}

// "Disable" Guest Donation. Checkbox
// See: https://github.com/WordImpress/Give/issues/1470
$guest_donation = get_post_meta( get_the_ID(), '_give_logged_in_only', true );
$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
update_post_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );

// Offline Donations
// See: https://github.com/WordImpress/Give/issues/1579
$offline_donation = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true );
if ( 'no' === $offline_donation ) {
$offline_donation_newval = 'global';
} elseif ( 'yes' === $offline_donation ) {
$offline_donation_newval = 'enabled';
} else {
$offline_donation_newval = 'disabled';
}
update_post_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval );

// Convert yes/no setting field to enabled/disabled.
$form_radio_settings = array(
// Custom Amount.
Expand All @@ -744,9 +755,6 @@ function give_v18_upgrades_form_metadata() {
// Term & conditions.
'_give_terms_option',

// Offline donation.
'_give_customize_offline_donations',

// Billing fields.
'_give_offline_donation_enable_billing_fields_single',
);
Expand Down Expand Up @@ -782,7 +790,6 @@ function give_v18_upgrades_form_metadata() {
delete_option( 'give_doing_upgrade' );
give_set_upgrade_complete( 'v18_upgrades_form_metadata' );


wp_redirect( admin_url() );
exit;
}
Expand Down
1 change: 0 additions & 1 deletion includes/scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ function give_load_admin_scripts( $hook ) {
'resend_receipts' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ),
),
),
'upgrade_confirmation' => __( 'Please make sure to create a database backup before initiating the upgrade.', 'give' ),
'metabox_fields' => array(
'media' => array(
'button_title' => esc_html__( 'Choose Attachment', 'give' ),
Expand Down