Muhammad Usama Ghouri
Forum Replies Created
-
@ammartello97
You’re welcome! I’m glad to hear that it’s working now 😊@ammartello97
Ok, I saw the page in which you are facing this issue
https://basbelarabi.com/checkout/?add-to-cart=50250&quantity=1
and in the console, I found the same problem/warning there that I got on my end. So if all debugging mode is deactivated and still gets this issue then a temporary solution for this is until the developers fix this in the next update because this issue is on the plugin’s developer-end. So manually set that warning in an index.php in international-telephone-input-with-flags-and-dial-codes plugin file if you are familiar with the code. In the index.php find
“public function footer()” (find this on the 106 line) and replace that with thispublic function footer() { if ( isset( $this->options['enable'] ) && esc_attr( $this->options['enable'] ) == 'on' ) { $excludeCountries = empty( $this->options['excludeCountries'] ) ? array() : $this->options['excludeCountries']; $preferredCountries = empty( $this->options['preferredCountries'] ) ? array() : $this->options['preferredCountries']; $onlyCountries = empty( $this->options['onlyCountries'] ) ? array() : $this->options['onlyCountries']; $initialCountry = ''; // Temporary fix if ( isset( $this->options['enable_geoip_loopup'] ) && $this->options['enable_geoip_loopup'] == 'on' ) { require_once WPITFDC_ROOT_DIR . '/includes/vendor/autoload.php'; // This creates the Reader object, $reader = new Reader( WPITFDC_ROOT_DIR . '/assets/vendor/GeoLite2-Country/GeoLite2-Country.mmdb' ); try { $VisitorGeo = $reader->country( $this->get_visitor_ip() ); $initialCountry = $VisitorGeo->country->isoCode; } catch ( Exception $e ) { $initialCountry = ''; } } ?> <script type="text/javascript"> jQuery( document ).ready( function( $ ) { let initialCountry = '<?= strtolower( $initialCountry ); ?>'; <?php if ( isset( $this->options['enable_geoip_loopup_ajax'] ) && $this->options['enable_geoip_loopup_ajax'] == 'on' ) { ?> $.get( "<?= admin_url( 'admin-ajax.php' ); ?>", { action: 'wpitfdc_get_visitor_country' }, function( data ) { initialCountry = data; do_the_plugin_thing(); } ); <?php } else { ?> do_the_plugin_thing(); <?php } ?> function do_the_plugin_thing() { $( "input[type='tel']" ).each( function( index, el ) { var name = ( typeof $( el ).attr( 'name' ) != 'undefined' && $( el ).attr( 'name' ) != '' ) ? $( el ).attr( 'name' ) : 'phoneNumber'; $( el ).removeAttr( 'name' ); var id = Date.now(); $( el ).after( '<input type="hidden" id="countryCode'+ id +'" name="'+ name +'" />' ); $( el ).intlTelInput( { excludeCountries: <?= json_encode( $excludeCountries ); ?>, initialCountry: initialCountry, onlyCountries: <?= json_encode( $onlyCountries ); ?>, preferredCountries: <?= json_encode( $preferredCountries ); ?>, separateDialCode: true, } ); setInterval( function() { var newVal = $( "input#countryCode" + id ).prev( '.iti' ).find( '.iti__selected-dial-code' ).text() + $( el ).val(); if ( newVal == $( "input#countryCode" + id ).val() ) { return; } if ( $( el ).val() == '' ) { newVal = ''; } $( "input#countryCode" + id ).val( newVal ); }, 1000 ); } ); } } ); </script> <?php } }After that issue is resolved temporarily until developers fix that in their end in next update.
- This reply was modified 2 years, 3 months ago by Muhammad Usama Ghouri.
And I hope in the next update of this plugin, plugin developers will solve the following issue/warning.
Warning: Undefined variable $initialCountry in wp-content\plugins\international-telephone-input-with-flags-and-dial-codes\index.php on line 139.I found out why this issue was happening, which means why it shows this warning
Warning: Undefined variable $initialCountry in wp-content\plugins\international-telephone-input-with-flags-and-dial-codes\index.php on line 139.
and when I tested on another site then showed no error and worked fine.
I found it is due to not disabling the debugging mode in the wp-config.php file.
define(‘WP_DEBUG’, false);
So when I disabled the debugging mode then no warning or notice showed and the issue was resolved.@ammartello97
I am also using the Ultimate member plugin.
I found out why this issue was happening, which means why it shows this warning
Warning: Undefined variable $initialCountry in wp-content\plugins\international-telephone-input-with-flags-and-dial-codes\index.php on line 139.
and when I tested on another site then showed no error and worked fine.
I found it is due to not disabling the debugging mode in the wp-config.php file.
define(‘WP_DEBUG’, false);
So when I disabled the debugging mode then no warning or notice showed and the issue was resolved.
Hope this helps you.@ammartello97
Yes, the problem is solved. I was facing this issue on localhost. So when I tested it on the live site then no error showed in my case. Not figured out why getting the following warning on localhost.
Warning: Undefined variable $initialCountry in wp-content\plugins\international-telephone-input-with-flags-and-dial-codes\index.php on line 139.
Maybe due to some conflict.
So disable all other plugins to find out which plugin causes conflict.
So which form you are using?
I am using the Ultimate member plugin form.- This reply was modified 2 years, 3 months ago by Muhammad Usama Ghouri.
@missveronicatv
The problem was solved when I tested it on the live site.
The issue or warning showed when working on localhost. Not figure out why?
Thanks for the support.- This reply was modified 2 years, 3 months ago by Muhammad Usama Ghouri.
— WordPress Version: 6.4.3
—UM Version: 2.8.2
International Telephone Input With Flags And Dial Codes Version: 1.0.4But I still got a warning and when I searched this issue I found I am not the only one that facing this issue recently.
The same issue was also faced by others recently.
https://ww.wp.xz.cn/support/topic/country-code-didnt-show-anymore/But it’s not working.
https://prnt.sc/oPqSFmJtn–YE
I think it is due to some bug or issue in the plugin International Telephone Input With Flags And Dial Codes.
Warning: Undefined variable $initialCountry in wp-content\plugins\international-telephone-input-with-flags-and-dial-codes\index.php on line 139Yes, facing same issue.
https://prnt.sc/oPqSFmJtn-YE- This reply was modified 2 years, 3 months ago by Muhammad Usama Ghouri.
I had the same issue in tabs when I put shortcodes in it but in my case, now it is resolved and I found the issue is due to the “return” used to output the user message in the render function. The issue was resolved when I used “echo” to print user messages instead of “return”.
For Example when using “return” to print user messages
public function renderFunction($atts) {
    ob_start();
    $current_user = wp_get_current_user();
    $user_roles = $current_user->roles;
    if (!in_array('student', $user_roles)) {
      return 'You do not have the student role.';
    } else {
      $courses = get_user_meta($current_user->ID, '_course', true);
      if (empty($courses)) {
        return 'No courses found for this student.';
      } else {
        if ($_SERVER['REQUEST_METHOD'] === 'POST') {
          $this->handleFormSubmission($current_user, $courses);
        }
        $this->displayCourseHistoryTable($current_user->ID);
      }
    }
    return ob_get_clean();
  }
in this, I used return to print messages but when I used echo instead of return the issue was resolved.
I hope you found this helpful.- This reply was modified 2 years, 4 months ago by Muhammad Usama Ghouri.
- This reply was modified 2 years, 4 months ago by Muhammad Usama Ghouri.
WordPress Version: 6.4.2
UM Version: 2.8.2
After debugging I found that the problem was not configuring mail SMTP. After configuring the mail SMTP the issue was resolved. 🙂
Thanks for the support…- This reply was modified 2 years, 4 months ago by Muhammad Usama Ghouri.