Skip to content

Commit

Permalink
Merge pull request #108 from MaximilianoRicoTabo/feature/check-gatewa…
Browse files Browse the repository at this point in the history
…y-labeling-pbc-addon

PBC Labeling
  • Loading branch information
dparker1005 committed Dec 11, 2023
2 parents 1aed933 + 6c15f68 commit 6fc4edc
Showing 1 changed file with 10 additions and 7 deletions.
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

0 comments on commit 6fc4edc

Please sign in to comment.