Smartcrawl Plugin sitemap error

Smartcrawl mydomain.com/sitemap.xml produces the following error
-----------------------
This page contains the following errors:

error on line 2 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.
---------------------

The rest of the page is blank

  • joe

    This is becoming extremely strange.
    The above error still exists, but the Smartcrawl "Path to the XML Sitemap" no longer exists.
    It has vanished.

    It was there earlier today and I had previously submitted it to Google (sevedral weeks ago), but today when I checked Google Console it was not listed - so I checked the path given by Smartcrawl, the file was there and I resubmitted it - now it is gone?

    What can be happening.? This is serious.

  • Predrag Dubajic

    Hi Joe,

    I tried creating sitemap file on my installation while running iTheme2 active and I didn't get the above error you are having.
    Did you made any changes to your theme files?

    The above error still exists, but the Smartcrawl "Path to the XML Sitemap" no longer exists.
    It has vanished.

    Were there any changes on your site since this happened, any new plugins installed or updated?

    Best regards,
    Predrag

  • Predrag Dubajic

    Hi Joe,

    I had a quick look at your theme files and see that there are some differences between your theme files and once on my installation which are from default iTheme2.

    Could you tell us what changes were made to your theme and have you tried using non-modified theme to see if there are issues after that as well?

    I have received your email with 404 errors and I'm currently looking into this with one of our developers so I will update you on your other thread once we have further info regarding this.

    Best regards,
    Predrag

  • joe

    Hi Predrag

    I have kept the theme at 1.7.4 and framework 2.4.1 because upgrading to the latest with framework 2.4.4 seems to cause the home page slider to stop working.

    The only change I can remember to the current theme was one that was causing Google maps to display wrongly

    /themes/itheme2/themify/themify-shortcodes.php line no 64.

    add_shortcode('map', 'themify_shortcode');

    changed to

    //add_shortcode('map', 'themify_shortcode');

    In other words the line was simply commented out and the maps started working correctly.

  • Adam Czajczyk

    Hello Joe!

    Thanks for fixing this. I was able to access and check your site now :slight_smile:

    The error in sitemap is a result of XML content starting from a second line (the first line of the file is blank) and this breaks strict standard of the specs. I tested it with different config settings on my own site and no matter what I did I wasn't able to replicate this. I don't think it's a SmartCrawl bug and I wouldn't even point to any of plugins "per se".

    I did however checked sitemap on your staging site and noticed that there's a newer version of iTheme2 used there. No sitemap error as well.

    Along with Predrag's tests and your test (switching to Twenty Fifteen) it would confirm that most likely the theme is causing it. I run through iTheme2 config/setup but it seems there's no settings that could affect this, therefore I suspect there must be some kind of bug or error in theme files.

    However, given access to your staging site I wasn't able to check this. Unfortunately, the only version of iTheme2 that I was able to download is current version. That said, could I ask you to allow me to access also your live site via FTP? This would let me check the theme and hopefully find the main culprit here. As I realize it's a live site, I can assure you that I'll not make any changes on my own without your prior permission.

    In order to let me access the site please send in:

    Subject: "Attn: Adam Czajczyk"

    - your site's WordPress admin login URL
    - admin login and password (may be a temporary account)
    - FTP credentials (hostname, username, password, port number if needed)
    - any other relevant URLs and information
    - link back to this thread

    Please use our contact form here https://premium.wpmudev.org/contact/.
    Select "I have a different question" from the drop-down list.

    Please be sure to make a full backup of your entire site first!

    Best regards,
    Adam

  • joe

    Adam, I believe I have solved the issue of the sitemap, but it has brought with it a few downsides.

    Firstly I upgraded the Theme which seems to have sorted the sitemap error (so far so good)
    I also made a cutom-style.css which I placed in the theme folder so I would retain the colour changes and such that I had made in the previous theme.

    So now I have the latest theme and framework version.

    Now the downside:
    The slider only works with the Builder enabled, and I definitely don't want my users messing with that.
    I have managed to hide most of the Builders appearances with some custom CSS, and some additions to custom-functions, but it persists in some areas that will surely cause a little confusion for users.

    I use Easy Blogging plugin and when a user clicks "My Pages" they see a list of pages, but as they don't have the user level permissions to edit when they hover over an item they see two sub menu items
    "View" and "Themify Builder" - I can't seem to figure out how to get rid of that "Themify Builder" link

    The link does not go to the Builder thanks to the custom functions and CSS, it just goes to a page, but I would like to get rid of it completely.

    Also when a user with correct permissions clicks New Page they get the options I expect, but when they click "New Post" there is a heading to Themify Custom Panel - again it goes nowhere, but I would like to get rid of it except for users with the permissions to use it, which will probably only ever be administrators.

    One other point, with Easy Blogging, the menu items "My Pages" and "My Posts" suggests to me that the user should only see Pages and Posts which they have the permission to edit, rather than an entire listing of pages and posts.
    Regards

    Joe

  • Adam Czajczyk

    Hello Joe!

    Firstly I upgraded the Theme which seems to have sorted the sitemap error (so far so good)

    That's great to know! Although I expected that upgrading theme would fix the issue (as proved by tests on my own setup) I didn't suggest it because I remembered you mentioned before that you'r keeping that older version for a reason.

    As for these new issues. In order to be able to test that out I've let myself create an account for me and create myself a site. I logged in as this new user and indeed dashboard is in "Easy blogging" mode.

    However, after clicking on "My Pages" I can only see my own site which, I presume, is as it should be. Also, there's not "Themify Builder" link anywhere. I suppose then I'd need to either assign myself different user role than default or tweak some other settings. Could you please let me know a bit more on this so I could check on my own?

    Best regards,
    Adam

  • joe

    Hello Adam, hope you are well.

    Site creation is not enabled, how did you manage to create one?
    PERHAPS YOU SHOULD EMAIL ME THIS ANSWER AS I DONT WANT IT SHOWN

    From your Dashboard >> Visit Site >> My Sites >> Main Site >> Dashboard >> My Posts and hover over a post and you will see the Builder link (disabled but will confuse users)

    Also >> New Post and underneath the Content Editor box is "Custom Panel", again disabled but will confuse users.

  • Adam Czajczyk

    Hello Joe,

    Thanks for the answer.

    I think I may answer you without exposing any "secret ways": you granted me a support access to your site. None of the site creation restrictions were changed or broken here so I think there's nothing to worry about here. Of course please feel free to remove that site as according to your recent post I will not need it anymore.

    That said, I followed your instruction and I think the simplest way would be to simply hide the "Themify Bulider" link with CSS. This rules should do this:

    .wp-admin #posts-filter .themify-builder {display:none;}

    You could add this to your site via our "Ultimate Branding" plugin's "Custom Admin CSS" feature.

    This CSS would also hide the link for super-admin but I imagine it wouldn't be a big issue here as you should be able to access "Themify Builder" other way.

    Would hiding Themify "Custom Panel" via CSS also work for you?

    #themify-meta-boxes {display:none;}

    Best regards,
    Adam

  • Adam Czajczyk

    Hey Joe!

    I admit this is a bit strange. I assume something is "blocking" this CSS rules from being applied there. Could you please try applying this style by outputting it via Admin Footer? This could be done with this functions:

    <?php
    function custom_styling() {
    $script =<<<'EOStyle'
    	    <style>
    .wp-admin #posts-filter .themify-builder {display:none;}
    	    </style>
    EOStyle;
    	    echo $script;
    }
    add_action('admin_footer', 'custom_styling');
    ?>

    Just put this code into a file with .php extension and upload it to your /wp-content/mu-plugins/ folder.

    If this still doesn't help, please try changing:

    display:none;

    to

    display:none!important;

    Let me know please if it helped!

    Best regards,
    Adam

  • Adam Czajczyk

    Hey Joe!

    Let's try this another way then:

    <?php
    function custom_styling() {
    $script =<<<'EOScript'
    	    <script>
                 jQuery(document).ready(function ($) {
                 	('.wp-admin #posts-filter .themify-builder').hide() ;
                 })
    	    </script>
    EOScript;
    
    echo $script;
    }
    add_action('admin_footer', 'custom_styling');
    ?>

    I really hope that this will work as I must admit I'm pretty much out of ideas. This should work as initially suggested via Ultimate Branding. Let me know please if this version helped (just replace previous one, as mu-plugin) and if it won't I'll mobilize our 2nd-lin support Jedi Forces for help :slight_smile:

    Best regards,
    Adam

  • Adam Czajczyk

    Hello Joe,

    Thanks for the feedback.

    I'm sorry it didn't work for you. This is confusing a bit since the code works great when applied via browser's CSS editor and frankly, I never encountered such an issue before.

    That said, I've forwarded this to our 2nd-line support and hopefully they'll be able to help us here. So, photon torpedoes armed, away team ready, just waiting for Scotty to beam them up :slight_smile:

    Please keep an eye on this thread for further information!

    Best regards,
    Adam

    PS. Could you please keep support access open so 2nd-line support guys would be able to take a look as well? Thanks!

  • Adam Czajczyk

    Hey Joe!

    Actually, I totally forgot about that security geo-location feature on your site and now my colleague that was about to check your site again is also redirected to Yahoo. He's from India but we're a distributed team from all over the world (India, UK, US, Poland and many other countries) so it would be great if you could either temporarily disable that IP block while we're supporting the site or perhaps there's other way to exclude as from this limit?

    Thanks!
    Adam

  • joe

    Your colleague in India caused my site to go down with a 500 error
    Logs showed this.....

    [Sun Dec 13 22:12:56 2015] [warn] [client 106.51.140.182] mod_fcgid: stderr: PHP Fatal error: Cannot redeclare custom_styling() (previously declared in ../../..//MY DOMAIN/httpdocs/wp-content/mu-plugins/remove_builder_link.php:9) in MYDOMAIN/httpdocs/wp-content/themes/itheme2/theme-functions.php on line 652, referer: https://MYDOMAIN/wp-admin/themes.php?page=simple-custom-css.php

    I have deleted the file mu-plugins/remove_builder_link.php and site access was restored.

    This is a LIVE site - care must be taken not to cause it to go offline !

  • Jude

    Hey @joe

    You are right .. changes the functions.php is temporary. I was just checking if a !important directive would change anything. What I failed to realize was Adam already added similar code in your mu-plugins folder. Ultimately my final code will go back to your mu-plugin.

    This caused the slight downtime. Also why I requested FTP details so this can be avoided. Sorry about the downtime

    Jude

  • Jude

    Howdy @joe

    Its done. Leaving the code here for you reference

    function remove_row_actions( $actions )
    {
        if( get_post_type() === 'post' )
            unset( $actions['themify-builder'] );
        return $actions;
    }
    add_filter( 'post_row_actions', 'remove_row_actions', 999, 1 );
    
    function remove_post_custom_fields() {
    	remove_meta_box( 'themify-meta-boxes' , 'post' , 'normal' );
    }
    add_action( 'admin_menu' , 'remove_post_custom_fields' );

    Cheers
    Jude

  • joe

    Jude, unfortunately I have been too quick to agree this issue is fixed.

    I only checked one of the problems of the builder showing in" My Posts"
    In "New Post" the Themify Custom Panel heading still shows.

    Also, if the user can create pages, and therefore has a "My Pages" dashboard link, they have Themify Builder showing with the Edit, Quick Edit and View menu items.

    Only Super Admin should see and have access to this Builder.

    Also, I don't understand why a Subscriber in Easy Blogging who clicks "My Posts" gets a list of all the posts on the site instead of just the ones they created.

  • Michael Bissett

    Hey @joe,

    Last things first:

    Also, I don't understand why a Subscriber in Easy Blogging who clicks "My Posts" gets a list of all the posts on the site instead of just the ones they created.

    While not unexpected (from the way that WordPress works), it's something that can be adjusted, we'd want to take this one to a separate thread (this thread's already really, really long, and hard to follow).

    The hint to what you're wanting, though (and please mention this in the new thread), is this discussion.

    Now, regarding this:

    I only checked one of the problems of the builder showing in" My Posts"
    In "New Post" the Themify Custom Panel heading still shows.

    Also, if the user can create pages, and therefore has a "My Pages" dashboard link, they have Themify Builder showing with the Edit, Quick Edit and View menu items.

    The FTP details sent to my colleague Jude on the 13th are no longer working, seems like the password's changed in the meantime? Could you get those back online for me? :slight_smile:

    Kind Regards,
    Michael

  • Michael Bissett

    Hey @joe,

    Okay, I've just adjusted the mu-plugin on your site, so it'll now remove the Themify Builder for posts & pages (both in My Posts/My Pages, as well as Add/Edit Post & Add/Edit Page), but only if a user is not a super admin (since you had mentioned only wanting super admins accessing the builder).

    For future reference, here's the code that it's inside that mu-plugin now:

    function remove_row_actions_posts( $actions )
    {
        if( get_post_type() === 'post' && !is_super_admin() ) {
            unset( $actions['themify-builder'] );
    	}
        return $actions;
    }
    add_filter( 'post_row_actions', 'remove_row_actions_posts', 999, 1 );
    
    function remove_row_actions_pages( $actions )
    {
        if( get_post_type() === 'page' && !is_super_admin() ) {
            unset( $actions['themify-builder'] );
    	}
        return $actions;
    }
    add_filter( 'page_row_actions', 'remove_row_actions_pages', 999, 1 );
    
    function remove_post_custom_fields() {
    	if( !is_super_admin() ) {
    		remove_meta_box( 'themify-meta-boxes' , 'post' , 'normal' );
    		remove_meta_box( 'themify-meta-boxes' , 'page' , 'normal' );
    	}
    }
    add_action( 'admin_menu' , 'remove_post_custom_fields', 999 );

    Could you confirm that it's working as it should be on your end please? :slight_smile:

    Kind Regards,
    Michael

  • Michael Bissett

    Hey @joe,

    Hi Michael, it seems to be working ok from here for a low end user, and builder still available to superadmin

    Good to hear, glad that it's working! :slight_smile:

    The exception is My Posts and Comments for low end user which still shows all posts and comments rather than just those of author.

    As mentioned up here:

    https://premium.wpmudev.org/forums/topic/smartcrawl-plugin-sitemap-error#post-1000624

    The cause of that one is different, and would be something that we'd want to discuss in a separate thread. :slight_smile:

    Could you open a new thread for that please? And are we good to mark this one as resolved? :slight_smile:

    Kind Regards,
    Michael