• Resolved mmslko

    (@mujtaba677)


    The plugin is working good, I use simple country code output to give the price in their country. Though I don’t need currency exchange etc simply average price for few countries and rest of them in USD so this plug is useful.

    The only thing is that on setting page its saying:

    There has been a critical error on this website (wp-admin/admin.php?page=geot-settings) . Please check your site admin email inbox for instructions.

    So what is that, i have not received any email and why this message. Though there is nothing much earlier in your setting page except there was option to switch off debug button which I did, after that this message appearing.

    • This topic was modified 1 year, 10 months ago by mmslko.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Damian

    (@timersys)

    Could you check your server error_log file to find more about it?

    Thread Starter mmslko

    (@mujtaba677)

    [25-Jan-2023 13:38:31 UTC] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /home/web/htdocs/website.com/wp-content/plugins/geotargeting/admin/partials/settings-page.php:17 Stack trace: #0 /home/web/htdocs/website.com/wp-content/plugins/geotargeting/admin/includes/class-geotarget-admin-settings.php(52): include() #1 /home/web/htdocs/website.com/wp-includes/class-wp-hook.php(308): GeoTarget_Settings->settings_page() #2 /home/web/htdocs/website.com/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #3 /home/web/htdocs/website.com/wp-includes/plugin.php(517): WP_Hook->do_action() #4 /home/web/htdocs/website.com/wp-admin/admin.php(259): do_action() #5 {main} thrown in /home/web/htdocs/website.com/wp-content/plugins/geotargeting/admin/partials/settings-page.php on line 17

    Thread Starter mmslko

    (@mujtaba677)

    this is the error when i access your plugin setting and also my website is using cloudflare dns.

    Plugin Author Damian

    (@timersys)

    Do you know how to edit the plugin files? so we can try something?

    this file /home/web/htdocs/website.com/wp-content/plugins/geotargeting/admin/partials/settings-page.php

    On line 14

    change this:

    $opts = apply_filters('geot/settings_page/opts', get_option( 'geot_settings' ) );

    for this:

    $opts = apply_filters('geot/settings_page/opts', get_option( 'geot_settings', [] ) );

    Thread Starter mmslko

    (@mujtaba677)

    I really appreciate responding to my query:
    No change error remains same;

    here is your settings-page file

    <?php
    /**
     * Settings page template
     * @since  1.0.0
     */
     if (  isset( $_POST['geot_nonce'] ) && wp_verify_nonce( $_POST['geot_nonce'], 'geot_save_settings' ) ) {
    
         $settings = esc_sql( $_POST['geot_settings'] );
    
    	 update_option( 'geot_settings' ,  $settings);
    
     }
    
     $opts = apply_filters('geot/settings_page/opts', get_option( 'geot_settings', [] ) );
    
     if( empty( $opts['debug_mode'] ) ) {
    	 $opts['debug_mode'] = '0';
     }
    
    
    ?>
    <div class="wrap geot-settings">
    	<h2>GeoTargeting <?php echo $this->version;?></h2>
    	<form name="geot-settings" method="post" enctype="multipart/form-data">
    		<table class="form-table">
    			<?php do_action( 'geot/settings_page/before' ); ?>
    			<tr valign="top" class="">
    				<th><h3><?php _e( 'Main settings:', $this->GeoTarget ); ?></h3></th>
    			</tr>
    
    			<tr valign="top" class="">
    				<th><label for="maxm_id"><?php _e( 'Debug Mode', $this->GeoTarget ); ?></label></th>
    				<td colspan="3">
    					<label><input type="checkbox" id="maxm_id" name="geot_settings[debug_mode]" value="1" <?php checked($opts['debug_mode'] , '1');?> />
    						<p class="help"><?php _e( 'If you want to calculate user data on every page load and print in the footer debug info with check this.', $this->GeoTarget ); ?></p>
    				</td>
    			</tr>
    			<tr><td><input type="submit" class="button-primary" value="<?php _e( 'Save settings', $this->GeoTarget );?>"/></td>
    				<?php wp_nonce_field('geot_save_settings','geot_nonce'); ?>
    			</tr>
                <tr>
                    <td colspan="2"><h2>This plugin won't work if you have any page cache in your site/server. Only country shortcodes are available.</h2>
                    <p>If you need a complete geolocation tool with cache support check <a >GeotargetingWP plugin</a></p></td>
                </tr>
    		</table>
    	</form>
    </div>
    

    this is i believe the same error.

    [25-Jan-2023 15:39:54 UTC] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /home/website/htdocs/website.com/wp-content/plugins/geotargeting/admin/partials/settings-page.php:17 Stack trace: #0 /home/website/htdocs/website.com/wp-content/plugins/geotargeting/admin/includes/class-geotarget-admin-settings.php(52): include() #1 /home/website/htdocs/website.com/wp-includes/class-wp-hook.php(308): GeoTarget_Settings->settings_page() #2 /home/website/htdocs/website.com/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #3 /home/website/htdocs/website.com/wp-includes/plugin.php(517): WP_Hook->do_action() #4 /home/website/htdocs/website.com/wp-admin/admin.php(259): do_action() #5 {main} thrown in /home/website/htdocs/website.com/wp-content/plugins/geotargeting/admin/partials/settings-page.php on line 17

    Plugin Author Damian

    (@timersys)

    Try adding this on line 15

    if( ! is_array( $opts ) ) {
    $opts = [];
    }

    Thread Starter mmslko

    (@mujtaba677)

    Thank you, it works,

    Just because you are here there is notice on the page,
    This plugin won’t work if you have any page cache in your site/server. Only country shortcodes are available.

    So every site or server has some cache what will happen, it wont work?

    Plugin Author Damian

    (@timersys)

    Users will get cached results. You need to exclude the page where you use from cache.

    https://geotargetingwp.com does support caching

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Working good but on setting page saying error’ is closed to new replies.