Support » Plugin: Code Snippets » Add New > Blank Screen

  • Resolved Chris M.

    (@thinkdeep)


    Hello there!

    I’ve tried deactivating almost all plugins and I can’t figure out why there’s a blank screen whenever I go to “Add New” Snippet.

    http://d.pr/i/DmgF

    Any ideas?

    Could it be a hosting limitation?

    I’m using LiteSpeed Server.

    Thanks!

Viewing 15 replies - 1 through 15 (of 19 total)
  • I also get a 500 server error when I try to import a Snippet (using an XML file that I’ve confirmed working on another site).

    Okay, I’ve confirmed the plugin works on another site on the same server (different cPanel though, but same type of server, etc.)

    Hmmm… Any ideas?

    It was the official Intercom plugin!!!

    What the…?!

    Any ideas why this plugin would cause the “Add New” page to go blank?

    Thanks for your help!

    • This reply was modified 3 years, 7 months ago by Chris M.. Reason: added a link to the wrong plugin

    I’ve added a support request over at the Intercom plugin as well: https://wordpress.org/support/topic/this-plugin-breaks-the-popular-code-snippets-plugin/

    Any help here or there would be greatly appreciated.

    Plugin Author Shea Bunge

    (@bungeshea)

    Well done on figuring this out. I’ll try installing the Intercom plugin, and see if I can see what might be causing the issue.

    Thanks so much for your reply and for your willingness to help.

    Would LOVE to use your plugin, but it looks like Intercom is getting in the way here.

    Let me know what you find out.

    I sincerely appreciate it.

    ~ Chris

    [ No bumping please. ]

    Plugin Author Shea Bunge

    (@bungeshea)

    Ah ha. Figured it out.

    Looks like this is a simple naming conflict. In Code Snippets, I have a class called Snippet that represents a single snippet object.

    It looks like the Intercom plugin also defines a class called Snippet. I’m not sure why, as they really should be prefixing class names with Intercom_ or something.

    Anyway, there are really only three ways to resolve this:

    1. Intercom renames their class to something more sensible, such as Intercom_Snippet
    2. I rename the class in Code Snippets to something else, such as Code_Snippets_Snippet or Code_Snippet and hope that doing so does not break something else
    3. I implement PHP namespaces in this plugin. The result of doing so is that Code Snippets would require PHP 5.3 in order to run, making it inaccessable to anyone running PHP 5.2 (btw, if this is you, please upgrade!)

    I’d like to eventually do option (3), but I also don’t want to abandon people who are still using PHP 5.2. Ideally, Intercom would rename their Snippet class to something else, as I feel like the name Snippet makes more sense for this plugin than it does that one. Otherwise, I will just need to rename the class in this plugin.

    Awesome!

    And yeah, I’m on PHP 7, and have been for a while now.

    How many times does Snippet occur in the Intercom plugin, and where?

    Is there a functions.php filter that you know of that could auto-replace it for me for the time being? I wouldn’t know how to format the whole snippet, so I would appreciate it if you could spell it out (if this is possible).

    I’ve also submitted an official request for Intercom to update things on their end as well, but that could take some time (if they agree).

    Thanks for all your help here Shea! Epic support…

    And I agree, it would probably be a good idea to go for an even bigger win with Option #3 that you spelled out above.

    But yeah, it could potentially get crazy for a bit, for people that aren’t on PHP 5.3 and above.

    Honestly, everyone should really be on at least PHP 5.6+, if not 7, by now, as official support is completely dead for anything under PHP 5.6 –> http://d.pr/i/S6ZR (which I know you know, unfortunately, most people don’t, but your plugin’s audience is more sophisticated I would think).

    Plugin Author Shea Bunge

    (@bungeshea)

    I meant “you” in the general sense of “anyone reading the post”, but it is great to hear that you’re running PHP 7. I am in complete agreement that it is ridiculous to be running versions that have been unsupported for so many years, but unfortunately there are still people out there who are unable to or don’t know how to upgrade.

    Raising the PHP minimum version is definitely something I am planning on doing. The reason why I have held off so far is that I can work with PHP 5.2 compatible code without too many hardships, and I have no real way of knowing how many people are using 5.2/5.3 when the WordPress minimum version is still 5.2. But perhaps it’s time to do this sooner rather than later.

    Unfortunately, there’s no snippet or functions.php fix so solve this problem – if there was, I would implement it into the plugin. However, if you like you can edit the Intercom plugin files to fix things temporarily just for yourself. This isn’t going to help anyone else who is using Intercom with Code Snippets, but I doubt that there are too many people looking to do so.

    There are only two fixes to make. On line 321, change class Snippet to class Intercom_Snippet. And then change line 514 from $snippet = new Snippet($snippet_settings); to $snippet = new Intercom_Snippet($snippet_settings);

    These two changes should fix things so that both plugins work together harmoniously, though I am not able to actually test this right at the moment – I’ll do so tonight when I’m at my proper computer.

    • This reply was modified 3 years, 7 months ago by Shea Bunge.
    • This reply was modified 3 years, 7 months ago by Shea Bunge.

    Hey there!

    I got an email update from this thread, but I’m not seeing your comment here.

    But good news!

    In the email, you said:

    There are only two fixes to make. On line 321, change class Snippet to class Intercom_Snippet. And then change line 514 from $snippet = new Snippet($snippet_settings); to $snippet = new Intercom_Snippet($snippet_settings);

    So I found those two lines in the bootstrap.php file in the Intercom plugin, changed the relevant parts in both to Intercom_Snippet, and I think it’s working!

    Would love to get your “official” opinion though, if you get some time.

    Thanks so much for your help! 🙂

    Now let’s hope Intercom can review this and make the necessary changes (and any other ones needed).

    Thanks again!

    Plugin Author Shea Bunge

    (@bungeshea)

    Yeah, I’m not sure what happened. I submitted a post and it disappeared. It’s good to hear that I’m not just going crazy and imagining things. And yes, I was referring to bootstrap.php – I should have mentioned that.

    Glad to hear that things seem to be working temporarily. I’ll begin thinking about bumping the required PHP version a lot sooner rather than later. It’s probably about time to do so – I just hope there won’t be too many PHP 5.2 users.

    Yeah, maybe you could put out a “warning message” inside of the plugin and somehow make it very clear from the “outside”, before updating… not just in the version notes.

    But I think it would be a good move overall… PHP 5.2 is tooooooo old man! haha

    But I hear ya, you have to watch out for yourself as well, angry users, a flurry of support requests, etc… So it’s a balance.

    Plugin Author Shea Bunge

    (@bungeshea)

    That’s a good idea. I might also be able to make the plugin short-circuit instead of just crashing a site if it’s updated on a site running an old version of PHP.

    @bungeshea – Looks like Intercom fixed the issue!

    https://wordpress.org/support/topic/this-plugin-breaks-the-popular-code-snippets-plugin/

    But still rooting for the PHP upgrade to your plugin. May it all go well (or as well as it can, lol)!

    ~ Chris M.

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Add New > Blank Screen’ is closed to new replies.