Skip to content

Commit

Permalink
Dev - Remove payment addon dependency from stripe
Browse files Browse the repository at this point in the history
  • Loading branch information
lekhnathpandey committed Dec 7, 2023
1 parent 7d7a85d commit d9f7acc
Showing 1 changed file with 16 additions and 58 deletions.
74 changes: 16 additions & 58 deletions includes/admin/class-ur-admin-menus.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,57 +78,17 @@ public function add_upgradable_other_fields() {
'slug' => 'learndash',
'name' => __( 'User Registration LearnDash', 'user-registration' ),
),
array(
'id' => 'user_registration_stripe_gateway',
'label' => 'Stripe Gateway',
'icon' => 'ur-icon ur-icon-credit-card',
'field_class' => 'UR_Form_Field_Stripe_Gateway',
'plan' => 'ThemeGrill Agency Plan or Professional Plan or Plus Plan',
'slug' => array( 'stripe' ),
'name' => array( __( 'User Registration Stripe', 'user-registration' ) ),
),
);

if ( ! is_plugin_active( 'user-registration-payments/user-registration-payments.php' ) && ! is_plugin_active( 'user-registration-stripe/user-registration-stripe.php' ) ) {
$fields = array_merge(
$fields,
array(
array(
'id' => 'user_registration_stripe_gateway',
'label' => 'Stripe Gateway',
'icon' => 'ur-icon ur-icon-credit-card',
'field_class' => 'UR_Form_Field_Stripe_Gateway',
'plan' => 'ThemeGrill Agency Plan or Professional Plan or Plus Plan',
'slug' => array( 'payments', 'stripe' ),
'name' => array( __( 'User Registration Payments', 'user-registration' ), __( 'User Registration Stripe', 'user-registration' ) ),
),
)
);
} else {
if ( ! is_plugin_active( 'user-registration-payments/user-registration-payments.php' ) && is_plugin_active( 'user-registration-stripe/user-registration-stripe.php' ) ) {
$fields = array_merge(
$fields,
array(
array(
'id' => 'user_registration_stripe_gateway',
'label' => 'Stripe Gateway',
'icon' => 'ur-icon ur-icon-credit-card',
'field_class' => 'UR_Form_Field_Stripe_Gateway',
'plan' => 'ThemeGrill Agency Plan or Professional Plan or Plus Plan',
'slug' => 'payments',
'name' => __( 'User Registration Payments', 'user-registration' ),
),
)
);
} elseif ( is_plugin_active( 'user-registration-payments/user-registration-payments.php' ) && ! is_plugin_active( 'user-registration-stripe/user-registration-stripe.php' ) ) {
$fields = array_merge(
$fields,
array(
array(
'id' => 'user_registration_stripe_gateway',
'label' => 'Stripe Gateway',
'icon' => 'ur-icon ur-icon-credit-card',
'field_class' => 'UR_Form_Field_Stripe_Gateway',
'plan' => 'ThemeGrill Agency Plan or Professional Plan or Plus Plan',
'slug' => 'stripe',
'name' => __( 'User Registration Stripe', 'user-registration' ),
),
)
);
}
}

foreach ( $fields as $field ) {
if ( 'user_registration_learndash' === $field['id'] ) {
if ( ! defined( 'LEARNDASH_VERSION' ) ) {
Expand Down Expand Up @@ -348,8 +308,8 @@ public function add_upgradable_extra_fields() {
'section_title' => 'Payment Fields',
'fields_parent_class' => 'User_Registration_Payments_Admin',
'plan' => 'ThemeGrill Agency Plan or Professional Plan or Plus Plan',
'slug' => 'payments',
'name' => __( 'User Registration Payments', 'user-registration' ),
'slug' => array( 'payments', 'stripe' ),
'name' => array( __( 'User Registration Payments', 'user-registration' ), __( 'User Registration Stripe', 'user-registration' ) ),
'fields' => array(
array(
'id' => 'user_registration_single_item',
Expand Down Expand Up @@ -495,7 +455,6 @@ public function registration_page_init() {
)
);
}

}

/**
Expand Down Expand Up @@ -603,7 +562,7 @@ public function set_screen_option( $status, $option, $value ) {
public function registration_page() {
global $registration_table_list;
if ( isset( $_GET['tab'] ) && 'login-forms' === $_GET['tab'] ) { //phpcs:ignore WordPress.Security.NonceVerification
include_once dirname( __FILE__ ) . '/views/html-login-page-forms.php';
include_once __DIR__ . '/views/html-login-page-forms.php';
} else {
$registration_table_list->display_page();
}
Expand Down Expand Up @@ -665,13 +624,13 @@ public function add_registration_page() {
);
if ( isset( $_GET['edit-registration'] ) ) {
// Forms view.
include_once dirname( __FILE__ ) . '/views/html-admin-page-forms.php';
include_once __DIR__ . '/views/html-admin-page-forms.php';
} else {
UR_Admin_Form_Templates::load_template_view();
}

// Forms view.
include_once dirname( __FILE__ ) . '/views/html-admin-page-forms.php';
include_once __DIR__ . '/views/html-admin-page-forms.php';
}

/**
Expand Down Expand Up @@ -757,7 +716,7 @@ public function nav_menu_links() {
name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-classes]"/>
</li>
<?php
$i --;
--$i;
endforeach;
?>
</ul>
Expand Down Expand Up @@ -907,7 +866,7 @@ private function get_edit_form_field( $form_data ) {

foreach ( $rows as $grid_lists ) {

$grid_id ++;
++$grid_id;

echo '<div ur-grid-id="' . esc_attr( $grid_id ) . '" class="ur-grid-list-item ui-sortable" style="width: 48%; min-height: 70px;">';

Expand Down Expand Up @@ -1017,7 +976,6 @@ public function ur_get_list( $field ) {
if ( null !== $class_name ) {
echo wp_kses_post( $class_name::get_instance()->get_registered_admin_fields() );
}

}
}

Expand Down

0 comments on commit d9f7acc

Please sign in to comment.