Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1218868

    Hi,

    I became aware that the maps integrated via the plugin maps marker pro are not loading anymore. The following error is shown:

    “Error: the map with ID 1 could not be loaded. Please contact the site owner.”

    the developer console is showing this error: “[Maps Marker Pro] Error loading settings (SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data)”

    When I am logged in as a WP admin then the maps load as intended.

    Do you know how to fix the error?

    best regards, Peter

    #1219027

    Hi,

    UPDATE:

    I also asked the plugin developers about the issue. They say:

    “you site is redirecting admin-ajax.php to the home page. I assume this is from a security plugin and doesn’t happen for logged-in users. Maps Marker Pro requires admin-ajax.php to work. Please disable this feature.”

    I have then investigated the error further and I think I found the problem. In my child theme functions.php, I have included the following function because I don’t want website subscribers to access the WP backend at all.

    // redirect back to homepage and not allow access to wp backend for subscribers
    function rkk_redirect_admin(){
        if ( ! current_user_can( 'edit_posts' ) ){
            wp_redirect( site_url() );
            exit;
        }
    }
    add_action( 'admin_init', 'rkk_redirect_admin' ); 

    When commenting the function out the map loads for not logged in users, as intended. My understanding of WP developing and PHP is limited. What exactly is the problem with this function? How to adjust it in order to achieve subscribers not having access to WP backend and not cause the maps marker pro error?

    Best regards, Peter

    #1219224

    UPDATE:

    I have changed the if statement to the following:

    // redirect back to homepage and not allow access to wp backend for subscribers
    function rkk_redirect_admin(){
        if ( ! wp_doing_ajax() && ! current_user_can( 'edit_posts' ) ) {
            wp_redirect( site_url() );
            exit;
        }
    }
    add_action( 'admin_init', 'rkk_redirect_admin' );

    Now it doesn`t fire when admin_ajax.php is called. Is this a robust solution? Do you see any problems with this?

    Best regards, Peter

    #1221273

    Hi,

    Thank you for the update. This should be fine as long as you’re using an admin account or a user that can edit posts — else will be redirected to the home page.

    Best regards,
    Ismael

    #1221283

    Hi Ismael,

    thank you for your answer. I have no further questions on this issue.

    Please do have a look at my other open support requests, as I am hoping to make progress with the site.

    Best regards, Peter

    #1222040

    Hi,

    You’re welcome. We’ll close the thread now and be with you shortly in the next thread.

    Thank you for your patience.

    Best regards,
    Ismael

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Maps Marker Pro Maps not loading’ is closed to new replies.