mnelson4 / printmyblog

WordPress Plugin that simplifies printing your entire blog
GNU General Public License v3.0
16 stars 6 forks source link

White screen when saving PMB settings #317

Open KeymerHealth opened 2 years ago

KeymerHealth commented 2 years ago

Hi there!

I hope you are having a lovely week.

We are using WP Cloudflare Super Cache on our site, and one of the functions of this plugin is that logged in users get ?swcfpc=1 added to the URL in order to not cache private user data in case it is served to the wrong user.

Strangely, Printmyblog seems to be reacting to this, and is only able to provide prints to logged in users. Any attempt to print from a non-logged-in account will hang indefinitely in the 'initializing' state. However, logged in users of all user roles including admins all the way through to customer can use the print button fine with no issue. On all occassions when the print works fine, ?swcfpc=1 is also at the end of the URL, so the link to the Cloudflare Super Cache seems to be causal.

This is very frustrating as I feel that Printmyblog is exactly the plugin we need for our articles, as when it works, it seems to be a much better solution than the other options on the Wordpress marketplace.

On a similar but less important note, upon making any saves to the Printmyblog settings as an Admin, the page will turn white and freeze. However, closing the tab and then starting fresh in a new tab reveals that the changes were indeed saved. I presume this is also a compatability issue with WP Cloudflare Super Cache.

Please let me know your thoughts on this matter - I would appreciate any help you could offer with this issue.

Kind regards,

Adam

p.s. if you need to see the issue in action, I have the plugin live on our post here: https://www.keymerhealth.com/moringa-oleifera-leaves-nutrients/

mnelson4 commented 2 years ago

Hi @KeymerHealth, thanks for the details on the issue. Print My Blog (PMB) uses the WP REST API to fetch the post’s content, but it sounds like that part isn’t working for non-logged-in-users. You might have the WP REST API disabled for non-logged-in visitors. Are you using a security plugin?

Also, I’m wanting to confirm which plugin you’re using. Is it WP Super Cache with cloud flare (like in this post: https://wpdingo.com/setup-wp-super-cache-cloudflare)?

I’ll try to look into this issue more tomorrow

KeymerHealth commented 2 years ago

Hi Mike!

Thank you for your speedy reply!

You are indeed correct, and enabling the REST API for logged out users does indeed now allow anyone to print. Thank you!

I am not sure if you still require the plugin details, but maybe the admin save issue is related. Nonetheless I am now doubting my whole hypothesis, so it may not be an issue with this plugin at all! The plugin I am using is this one: https://wordpress.org/plugins/wp-cloudflare-page-cache/

Whilst I am here, I am also having issue with the image size function as I can only seem to get it to display in either fullsize or not at all. In other words, 3/4, 1/2, and 1/4 image size all result in full sized images on the print preview. If I should open up a new thread on here rather than using this one then please let me know as I am happy to do so.

Kind regards,

Adam

mnelson4 commented 2 years ago

Hi @KeymerHealth, great to hear there's some progress!

While testing your site I noticed I actually introduced a bug a couple days ago 😢 which made the print page appear blank and images not resize. The version I just released (3.12.9) a couple minutes ago fixes both problems.

The only remaining issue is the settings page freezing when you save settings. It's possible this is Cloudflare-related but it could be something else. I don't have Cloudlfare setup so am not able to test that. Here's some troubleshooting ideas though:

KeymerHealth commented 2 years ago

Hi @mnelson4,

Thank you for getting back to me so promptly again.

I have made a video that will hopefully outline what I am seeing from my end a bit more clearly.

https://www.youtube.com/watch?v=Xu1xejbcVbE

I probably went off track a few times in this but I hope at least it can provide some decent information and context for you! Please let me know if you require any further details.

Keen to hear your thoughts!

Kind regards,

Adam

mnelson4 commented 2 years ago

Hey Adam, thanks for the video description of the issues and for your appreciation of the plugin, despite these issues.

  1. blank screen: I'm using Firefox as well so it's probably a conflict with another plugin or your theme (which is also weird as it's a very basic form). From your WordPress admin dashboard, under the "Print My Blog" menu item, could you please go to the "Help" page and use that page to create a new issue on GitHub just for this item? Using that "Help" page will also add a lot of debugging information that will be helpful to determine which plugin may be causing this issue.
  2. images not resizing: that problem was a bug that should have been resolved in 3.12.9. I'm not sure if PMB got updated properly on your site (the CSS on it looks like it did on 3.12.8). Maybe you need to clear the cache (especially the CSS files)?
  3. left-aligning buttons: thanks that's a good suggestion. As a quick-fix, add this custom CSS to your site:
    .pmb-print-this-page{
    justify-content: flex-start;
    }
mnelson4 commented 2 years ago

Oh and regarding the tables: it looks like those tables use Javascript to load, but their Javascript probably isn't getting triggered on PMB's print page. That's an issue for PMB's Quick Print and current Print Buttons, but it might be resolved in Pro Print (which is newer and was created using everything I learned using the older Quick Print). Pro Print isn't yet available for site visitors though, so that's probably only an option in the future (and it will probably be a paid option.) If you want to use a different table plugin, you can use TablePress, which worked well with PMB last I tried it. Alternatively, you might want to use PMB's shortcodes to hide the tables in printouts and provide some alternative content (like a link to the table). See https://www.youtube.com/watch?v=xxNBkGafH_A on how to do that.

KeymerHealth commented 2 years ago

Hi Mike!

I hope you had a good weekend. I apologise for my delay in getting back to you on this.

  1. Blank Screen - Okay, I will make a new issue thread to help give you some more information to diagnose this.

  2. Image Resizing - You were correct! I guess the update did not register on my site for a little while because a couple of days later this is now working great just as you described. Thank you!

  3. Button Alignment - Awesome! Thank you, I am glad you like the suggestion! I do imagine that many users would find that a great feature, if it's not too much hassle to implement. The CSS you provided has worked beautifully in the meantime!

  4. Tables - I see! Okay that makes sense. I have replaced the plugin 'Ninja Tables' with the TablePress plugin as you suggested. Thankfully, I only had a handful of tables on the site, so entering the data manually in to the new plugin only took a bit of time. TablePress does indeed work great and displays mostly fine on the PMB print page. Many thanks for this suggestion! I do notice though that the chart table header colours varies sometimes between black and white and other times it uses the custom colours I selected for it. Not sure if that is a browser thing, a PMB thing, or a TablePress thing! This is however, a minor inconvinience in comparison to them not showing up at all!

Thank you very much for your help in getting all this working on my site. The standard browser print options on my site used to create a total mess of a page, so your plugin is a must have for me! 👍

Kind regards,

Adam

mnelson4 commented 2 years ago

Ok great. Regarding TablePress issue colours, if you want to point me to a post using it, I can probably identify how to fix it

KeymerHealth commented 2 years ago

Hi Mike,

I have attached a screenshot of the issue with the tables.

I get this display in Firefox, Brave, and the DuckDuckGo mobile browser on this article:

As you can see the title text that displays as white in the post has become a dark grey which is almost illegible on the green background.

However, strangely it sometimes renders the heading row with no background colour at all so I will be interested to know if the error is repeatable on your end too.

Kind regards,

Adam


firefox-pmb-table-04-04-2022

KeymerHealth commented 2 years ago

Oops, it seems Github ate the URL. I will try to link it again!

https://www.keymerhealth.com/moringa-oleifera-leaves-nutrients/

mnelson4 commented 2 years ago

Hey @KeymerHealth, your Theme (Divi), TablePress and Print My Blog really share the guilt here. Print My Blog's print page has different HTML markup than your regular page (specifically, it puts all the content into an element with the CSS class "entry-content", whereas your regular pages don't) which is causing some different CSS from your theme to override TablePress' CSS.

Anyway, this custom CSS should fix the issue on your site:

.tablepress thead th{
color: #fff !important;
}
KeymerHealth commented 2 years ago

Hi Mike,

Oh wow! I suppose as they say, it's both the strength and weakness of Wordpress that so many different parts can be stuck together. Sometimes I find it amazing that there aren't more conflicts like that with all the third party plugins I have installed, but that must be a credit to all the developers such as yourself writing good code.

Thank you for that CSS, it has indeed worked excellently! 👍

Kind regards,

Adam

P.S. I was in the process of creating the second Github issue thread like you suggested regarding the blank page upon saving, but I noticed that it does indeed display a lot of debugging related information. I am not sure if I am being paranoid but as I am new to the Github way of doing things, is there a way I can send you that information privately as opposed to posting it in a publicly viewable thread? Please let me know your thoughts.

mnelson4 commented 2 years ago

Hey @KeymerHealth. The idea there was that if I were providing so much free support, that at least the information would be public so others could benefit from it. And maybe that’s correct. But regardless, I had planned to change that, as providing GitHub has been a pain for me as well as less-technical users. Watch for an upcoming update which give you email support just like pro plan users.

mnelson4 commented 2 years ago

ok all support is now offered via email, so you can use the updated plugin's "help" page to send me the debugging information directly.

KeymerHealth commented 2 years ago

Hi Mike,

Okay great! That is awesome news. I have updated PMB and will get that email sent your way.

Kind regards,

Adam