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

PBC Labeling #108

Merged
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
17 changes: 10 additions & 7 deletions pmpro-pay-by-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,19 @@ function pmpropbc_pmpro_membership_level_after_other_settings()
{
$level_id = intval($_REQUEST['edit']);
$options = pmpropbc_getOptions($level_id);
$check_gateway_label = get_option( 'pmpro_check_gateway_label' ) ?: __( 'Check', 'pmpro-pay-by-check' ); // Default to 'Pay by Check' if no option is set.
?>
<h3 class="topborder"><?php _e('Pay by Check Settings', 'pmpro-pay-by-check');?></h3>
<p><?php _e('Change this setting to allow or disallow the pay by check option for this level.', 'pmpro-pay-by-check');?></p>
<h3 class="topborder"><?php echo esc_html( sprintf( __( 'Pay by %s Settings', 'pmpro-pay-by-check' ), $check_gateway_label ) ); ?></h3>
<p><?php echo esc_html( sprintf( __( 'Change this setting to allow or disallow the "Pay by %s" option for this level.', 'pmpro-pay-by-check' ), $check_gateway_label ) ); ?></p>
<table>
<tbody class="form-table">
<tr>
<th scope="row" valign="top"><label for="pbc_setting"><?php _e('Allow Pay by Check:', 'pmpro-pay-by-check');?></label></th>
<th scope="row" valign="top"><label for="pbc_setting"><?php echo esc_html( sprintf( __( 'Allow Paying by %s:', 'pmpro-pay-by-check' ), $check_gateway_label ) );?></label></th>
<td>
<select id="pbc_setting" name="pbc_setting">
<option value="0" <?php selected($options['setting'], 0);?>><?php _e('No. Use the default gateway only.', 'pmpro-pay-by-check');?></option>
<option value="1" <?php selected($options['setting'], 1);?>><?php _e('Yes. Users choose between default gateway and check.', 'pmpro-pay-by-check');?></option>
<option value="2" <?php selected($options['setting'], 2);?>><?php _e('Yes. Users can only pay by check.', 'pmpro-pay-by-check');?></option>
<option value="0" <?php selected($options['setting'], 0);?>><?php esc_html_e( 'No. Use the default gateway only.', 'pmpro-pay-by-check' );?></option>
<option value="1" <?php selected($options['setting'], 1);?>><?php echo esc_html( sprintf( __( 'Yes. Users choose between default gateway and %s.', 'pmpro-pay-by-check' ), $check_gateway_label ) );?></option>
<option value="2" <?php selected($options['setting'], 2);?>><?php echo esc_html( sprintf( __( 'Yes. Users can only pay by %s.', 'pmpro-pay-by-check' ), $check_gateway_label ) );?></option>
</select>
</td>
</tr>
Expand Down Expand Up @@ -156,6 +157,8 @@ function pmpropbc_checkout_boxes()

$options = pmpropbc_getOptions($pmpro_level->id);

$check_gateway_label = get_option( 'pmpro_check_gateway_label' ) ?: __( 'Check', 'pmpro-pay-by-check' );

//only show if the main gateway is not check and setting value == 1 (value == 2 means only do check payments)
if ( $gateway_setting != "check" && $options['setting'] == 1 ) { ?>
<div id="pmpro_payment_method" class="pmpro_checkout">
Expand All @@ -178,7 +181,7 @@ function pmpropbc_checkout_boxes()
</span> <!-- end gateway_$gateway_setting -->
<span class="gateway_check">
<input type="radio" name="gateway" value="check" <?php if($gateway == "check") { ?>checked="checked"<?php } ?> />
<a href="javascript:void(0);" class="pmpro_radio"><?php _e('Pay by Check', 'pmpro-pay-by-check');?></a> &nbsp;
<a href="javascript:void(0);" class="pmpro_radio"><?php echo esc_html( sprintf( __( 'Pay by %s', 'pmpro-pay-by-check' ), $check_gateway_label ) ); ?></a> &nbsp;
</span> <!-- end gateway_check -->
<?php
//support the PayPal Website Payments Pro Gateway which has PayPal Express as a second option natively
Expand Down