Created
January 28, 2018 03:49
-
-
Save xnau/b2da5e45d8ec4a774dd231121791c8ad to your computer and use it in GitHub Desktop.
Demonstrates how to control the payment method according to the member's payment status
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
<?php | |
/* | |
* demonstrates a profile payment form where the payment is controlled by the member's payment status | |
*/ | |
?> | |
<div class="wrap <?php echo $this->wrap_class ?>"> | |
<?php | |
if ( !empty( $this->participant_id ) ) : | |
// output any validation errors | |
$this->print_errors(); | |
?> | |
<?php | |
// print the form header | |
$this->print_form_head() | |
?> | |
<?php pdb_field_group_tabs( $this ) ?> | |
<?php while ( $this->have_groups() ) : $this->the_group(); ?> | |
<fieldset class="field-group field-group-<?php echo $this->group->name ?> <?php echo $this->group->printing_title() ? 'group-with-title' : 'group-no-title' ?>"> | |
<?php $this->group->print_title( '<legend>', '</legend>' ) ?> | |
<?php $this->group->print_description() ?> | |
<?php | |
// step through the fields in the current group | |
while ( $this->have_fields() ) : $this->the_field(); | |
?> | |
<div class="form-group <?php $this->field->print_element_class() ?>"> | |
<label> | |
<?php $this->field->print_label() ?> | |
</label> | |
<div class="input-group" > | |
<?php $this->field->print_element_with_id(); ?> | |
</div> | |
<?php if ( $this->field->has_help_text() ) : ?> | |
<p class="help-block helptext"><?php $this->field->print_help_text() ?></p> | |
<?php endif ?> | |
</div> | |
<?php endwhile; // field loop ?> | |
<?php | |
global $PDb_Member_Payments; | |
$user_status_info = $PDb_Member_Payments->user_status_info( $this->participant_values['id'] ); | |
?> | |
<label>Your Current Payment Status is: <?php echo ucfirst( $user_status_info['payment_status'] ) ?></label> | |
<?php if ( $this->current_group_pointer > $this->group_count && $user_status_info['payment_status'] !== 'paid' ) : ?> | |
<div class="form-group payment-form"> | |
<label> | |
<?php pdb_member_payments_print_payment_button_label() ?> | |
</label> | |
<div class="input-group" > | |
<?php | |
global $PDb_Member_Payments; | |
$PDb_Member_Payments->print_record_payment_button(); | |
?> | |
</div> | |
</div> | |
<?php endif ?> | |
<div id="submit-button" class="controls"> | |
<?php pdb_field_group_tabs_submit_button( $this ) ?> | |
</div> | |
</fieldset> | |
<?php endwhile; // group loop ?> | |
<?php $this->print_form_close() ?> | |
<?php else : ?> | |
<?php | |
/* | |
* this part of the template is used if no record is found | |
*/ | |
echo empty( Participants_Db::$plugin_options['no_record_error_message'] ) ? '' : '<p class="alert alert-error">' . Participants_Db::plugin_setting( 'no_record_error_message' ) . '</p>'; | |
?> | |
<?php endif ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment