PluginProbe
MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings / 6.3.7
MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings v6.3.7
7.2.2 7.2.1 7.2 7.1.2 7.1.1 7.1 7.0.4 7.0.6 7.0.7 6.3.8 6.3.7 6.3.6 6.3.5 6.3.4 6.3.3 6.3.1 trunk 5.7.3 5.7.5 5.8.1 5.8.2 5.8.3 5.8.4 5.8.6 6.0.4 All 37 releases
mlsimport / admin / partials / mlsimport-onboarding-steps / step-account.php

step-account.php in MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings 6.3.7, at admin/partials/mlsimport-onboarding-steps/step-account.php

128 lines 7.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Refactored onboarding step using admin options, keeping original onboarding layout and logic.
4 */
5
6 if (!defined('ABSPATH')) exit;
7 global $mlsimport;
8
9 settings_fields( 'mlsimport_admin_options');
10 do_settings_sections('mlsimport_admin_options');
11 $options = get_option('mlsimport_admin_options');
12
13
14 $settings_list = array(
15 'mlsimport_username' => array('name' => esc_html__('MLSImport.com Username (not your email)', 'mlsimport')),
16 'mlsimport_password' => array('name' => esc_html__('MLSImport.com Password', 'mlsimport')),
17 'mlsimport_mls_name' => array('type' => 'select', 'name' => esc_html__('Your MLS', 'mlsimport')),
18 'mlsimport_mls_token' => array('name' => esc_html__('Your API Server token - provided by your MLS', 'mlsimport')),
19 'mlsimport_tresle_client_id' => array('name' => esc_html__('Your Trestle Client ID - provided by your MLS', 'mlsimport')),
20 'mlsimport_tresle_client_secret' => array('name' => esc_html__('Your Trestle Client Secret - provided by your MLS', 'mlsimport')),
21 'mlsimport_connectmls_username' => array('name' => esc_html__('Your ConnectMLS Username - provided by your MLS', 'mlsimport')),
22 'mlsimport_connectmls_password' => array('name' => esc_html__('Your ConnectMLS Password - provided by your MLS', 'mlsimport')),
23 'mlsimport_rapattoni_client_id' => array('name' => esc_html__('MLSImport Rapattoni Client id', 'mlsimport')),
24 'mlsimport_rapattoni_client_secret' => array('name' => esc_html__('MLSImport Rapattoni Client Secret', 'mlsimport')),
25 'mlsimport_rapattoni_username' => array('name' => esc_html__('MLSImport Rapattoni Username', 'mlsimport')),
26 'mlsimport_rapattoni_password' => array('name' => esc_html__('MLSImport Rapattoni Client Password', 'mlsimport')),
27 'mlsimport_paragon_client_id' => array('name' => esc_html__('MLSImport Paragon Client id', 'mlsimport')),
28 'mlsimport_paragon_client_secret' => array('name' => esc_html__('MLSImport Paragon Client Secret', 'mlsimport')),
29 'mlsimport_realtorca_client_id' => array('name' => esc_html__('MLSImport Realtor.ca Client id', 'mlsimport')),
30 'mlsimport_realtorca_client_secret' => array('name' => esc_html__('MLSImport Realtor.ca Client Secret', 'mlsimport')),
31 'mlsimport_brightmls_client_id' => array('name' => esc_html__('Your BrightMLS Client ID - provided by your MLS', 'mlsimport')),
32 'mlsimport_brightmls_client_secret' => array('name' => esc_html__('Your BrightMLS Client Secret - provided by your MLS', 'mlsimport')),
33 'mlsimport_theme_used' => array('type' => 'select', 'name' => esc_html__('Your Wordpress Theme', 'mlsimport')),
34 );
35
36 $token = $mlsimport->admin->mlsimport_saas_get_mls_api_token_from_transient();
37 $is_mls_connected = get_option('mlsimport_connection_test', '');
38 $mlsimport->admin->mlsimport_saas_setting_up();
39
40 if ('yes' !== $is_mls_connected) {
41 $mlsimport->admin->mlsimport_saas_check_mls_connection();
42 $is_mls_connected = get_option('mlsimport_connection_test', '');
43 }
44
45 if (trim(string: $token) === '') {
46
47 echo '<div class="mlsimport_warning">' . esc_html__('You are not connected to MlsImport - Please check your Username and Password.', 'mlsimport') . '</div>';
48 } else {
49 echo '<div class="mlsimport_warning mlsimport_validated">' . esc_html__('You are connected to your MlsImport account!', 'mlsimport') . '</div>';
50 }
51
52 if ('yes' === $is_mls_connected) {
53 echo '<div class="mlsimport_warning mlsimport_validated">' . esc_html__('You are connected to your MLS.', 'mlsimport') . '</div>';
54 } else {
55 echo '<div class="mlsimport_warning">' . esc_html__('The connection to your MLS was NOT succesful. Please check the authentication token is correct and check your MLS Data Access Application is approved.', 'mlsimport') . '</div>';
56 }
57
58 foreach ($settings_list as $key => $setting) {
59 $value = isset($options[$key]) ? esc_attr($options[$key]) : '';
60 echo '<fieldset class="mlsimport-fieldset fieldset_' . esc_attr($key) . '">';
61 echo '<label class="mlsimport-label" for="' . esc_attr('mlsimport_admin_options') . '-' . esc_attr($key) . '">' . esc_html($setting['name']) . '</label>';
62
63 if ($key === 'mlsimport_mls_name' && isset($setting['type']) && $setting['type'] === 'select') {
64 $mls_import_list = mlsimport_saas_request_list();
65 echo '<div class="mls_explanations">If your MLS is not on the list yet, requires manual activation, or if your credentials are not connecting, please <a href="https://mlsimport.com/contact-us/" target="_blank">contact us</a> for support.</div>';
66 echo '<input type="text" id="mlsimport_mls_name_front" name="mlsimport_admin_options[mlsimport_mls_name_front]" placeholder="search your MLS" value="' . esc_attr($options['mlsimport_mls_name_front'] ?? '') . '">';
67 echo '<input type="hidden" id="mlsimport_mls_name" name="mlsimport_admin_options[mlsimport_mls_name]" value="' . esc_attr($value) . '">';
68 } elseif ($key === 'mlsimport_theme_used' && isset($setting['type']) && $setting['type'] === 'select') {
69 $list = mlsiport_mls_select_list($key, $value, MLSIMPORT_THEME);
70 echo wp_kses($list, mlsimport_allowed_html_tags_content());
71 } else {
72 $password_fields = array('mlsimport_password', 'mlsimport_connectmls_password');
73 $type = in_array($key, $password_fields, true) ? 'password' : 'text';
74 echo '<input type="' . $type . '" class="mlsimport-input xxx" autocomplete="off" id="' . esc_attr( 'mlsimport_admin_options') . '-' . esc_attr($key) . '" name="' . esc_attr('mlsimport_admin_options') . '[' . esc_attr($key) . ']" value="' . $value . '" />';
75 }
76
77 if($key ==='mlsimport_password'){
78 echo '<button class="button button-primary mlsimport-save-account">'.esc_html__('Save account','mlsimport').'</button>';
79 echo '<a href="https://mlsimport.com/mls-import-plugin-pricing" class="button button-primary mlsimport-save-account" style="margin-left:15px;" target="_blank">'. esc_html__('Create My Account', 'mlsimport').'</a>';
80 }
81
82
83 echo '</fieldset>';
84 }
85
86 echo '<input type="hidden" name="mlsimport_admin_options[force_rand]" value="' . esc_attr(wp_rand()) . '">';
87 echo '<button class="button button-primary mlsimport-save-mls-data">'.esc_html__('Save MLS','mlsimport').'</button>';
88 ?>
89
90 <script>
91 jQuery(document).ready(function(jQuery) {
92 // Check initial state and disable/enable button accordingly
93 function updateContinueButtonState() {
94 var token = '<?php echo trim($token); ?>';
95 var isConnected = '<?php echo $is_mls_connected; ?>';
96 var $continueButton = jQuery('.mlsimport-wizard-content-account .mlsimport-wizard-next');
97 if (token === '' || isConnected !== 'yes') {
98 $continueButton.prop('disabled', true);
99 $continueButton.addClass('disabled');
100 } else {
101 $continueButton.prop('disabled', false);
102 $continueButton.removeClass('disabled');
103 }
104 }
105
106 // Run on page load
107 updateContinueButtonState();
108
109 // Handle continue button click on account step
110 jQuery('.mlsimport-wizard-content-account .mlsimport-wizard-next').on('click', function(e) {
111 e.preventDefault();
112
113 // Only proceed if button is not disabled
114 if (!jQuery(this).prop('disabled')) {
115 window.location.href = '<?php echo admin_url('admin.php?page=mlsimport-onboarding&step=field-mapping'); ?>';
116 }
117
118 return false;
119 });
120
121 // Enable button when MLS connection is successful
122 jQuery('.mlsimport-save-account, .mlsimport-save-mls-data').on('click', function() {
123 // Add slight delay to let AJAX complete
124 setTimeout(updateContinueButtonState, 1000);
125 });
126 });
127
128 </script>