Support » Plugin: Phoenix Media Rename » Fatal error on Multisite

  • Resolved Richard Archambault

    (@richardmtl)


    Hi! Your plugin unfortunately causes errors on multisite (at least, on *my* multisite!). Here’s what Query Monitor outputs as an error:

    
    Fatal error: Uncaught Error: Call to undefined function wp_get_current_user()
    in /home/XXXXXXX/public_html/wp-includes/capabilities.php on line 660
    
    Call stack:
    
    current_user_can()
    wp-admin/network/settings.php:16
    include_once()
    wp-content/plugins/phoenix-media-rename/phoenix-media-rename.php:24
    include_once()
    wp-settings.php:371
    require_once()
    wp-config.php:100
    require_once()
    wp-load.php:37
    require_once()
    wp-admin/admin.php:34
    require_once()
    wp-admin/network/admin.php:13
    require_once()
    wp-admin/network/index.php:11
    

    Note that my multisite currently only has 1 site in the network, and only 1 user, me, a Super Admin.

    To reproduce the error:

    1) Install the plugin from Network Admin
    2) Activate the plugin in a site in the network
    3) Go back to Network Admin, any URL, and you’ll see the error.

    Let me know if you can reproduce!

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author crossi72

    (@crossi72)

    Hi @richardmtl,
    I’m sorry for my late reply but I’ve been away from office for a few days.

    I’ll try to reproduce your issue and to fix it as soon as possible.

    C.

    Hi

    I have the same error just now.

    I am completely locked out of my Multisite Network Admin, this is a really bad coding.

    Testing of your plugin seems to be a real issue, because looking at the past errors, you are allowing your plugin to be installed in various environments where it could cause serious issues.

    Here is my error which suggests bad coding right out of the gate because I think wherever it can go wrong it has gone wrong!

    This is how to replicate the error:
    1) Install the plugin from Network Admin

    It went straight to the following error:

    Fatal error: Uncaught Error: Call to undefined function wp_get_current_user() in …/wp-includes/capabilities.php:660 Stack

    trace: #0 ../wp-admin/network/settings.php(16): current_user_can(‘manage_network_…’)

    #1 ../wp-content/plugins/phoenix-media-rename/phoenix-media-rename.php(24): include_once(‘/home/directory/…’)

    #2 /home/directory/public_html/domain.com/wp-settings.php(319): include_once(‘/home/directory/…’)

    #3 /home/jasonne4/public_html/domain.com/wp-config.php(105):
    require_once(‘/home/directory/…’)

    #4 /home/directory/public_html/domain.com/wp-load.php(37): require_once(‘/home/directory/…’)

    #5 /home/directory/public_html/domain.com/wp-admin/admin.php(34): require_once(‘/home/jasonne4/…’)

    #6 /home/directory/public_html/domain.com/wp-admin/network/admin.php(13): require_once(‘/home/directory/…’)

    #7 / in /home/directory/public_html/domain.com/wp-includes/capabilities.php on line 660

    Thread Starter Richard Archambault

    (@richardmtl)

    @jaegadigital I don’t think insults are necessary here.

    To regain access to your network admin, you can delete the plugin via SFTP or your control panel’s file manager, in the /wp-content/plugins/ folder.

    Thanks @richardmtl

    I still paid for a developer to sort it out, in the end, they said it wasn’t as simple as just deleting the plugin folder, either way, there is a cost of time and money.

    Admittedly I should have used rhetoric that read less critical, but ultimately if there is an issue with a plugin that creates the sort of issue I’ve had which caused the kind of frustration I didn’t need, it’s hard not to be brutally honest.

    The key point here is that the developer should make it clear that the plugin doesn’t support multisite until it’s resolved.

    That’s why I have added a one-star review with a clear flag about Multisite.
    Happy to change my review when it’s sorted, but unfortunately I can’t change my comment in the support.

    Plugin Author crossi72

    (@crossi72)

    Hi @jaegadigital,
    I know how frustrating can be installing a plugin that causes errors or (as in your case) crashes, but WordPress can be used in countless ways, so it is impossible to test every combination of themes, plugins and configurations.

    I’ll try to reproduce and resolve the issue that you and @richardmtl reported as soon as possibile, but I develop my plugin in my spare time so i can’t guarantee support in few hours and sometimes even in few days.

    I’m sorry about you issue but, as stated by @richardmtl, you can easily remove Phoenix Media Rename via FTP or other file management systems provided by your hosting service.

    I’ll let you know when I’ll release a new version that fixes this problem.

    C.

    Thread Starter Richard Archambault

    (@richardmtl)

    in the end, they said it wasn’t as simple as just deleting the plugin folder

    @jaegadigital Hmm, I’d like to know why not, because in my case, it definitely was that simple. I did it like 4 times just to be sure, before opening this bug report! You should ask the developer what the complication was; if it was a legitimate complication, then that might serve as useful information to the plugin author. 🙂

    I know how frustrating can be installing a plugin that causes errors … you can easily remove Phoenix Media Rename via FTP or other file management systems

    It’s not just a matter of installing a plugin that messes things up, I’ve had it installed without issue for the past few years, but the last update broke things pretty badly (so badly that we can’t even disable it form the GUI). Moreover, the “fix” isn’t easy at all and doesn’t work for two reasons:

    1) There’s no way to know that this plugin is the cause. We only end up here <i>after</i> determining it’s this plugin that caused the problem, not before. I had to rename the whole plugin folder, which caused everything to get disabled. Then I re-enabled them one at a time until I found the one that broke things. Now I have to try to figure out a way to find out which of the many plugins used to be enabled so that I can re-enable them (and hope their being disabled didn’t mess anything up). 😐

    2) Even if everything gets restored, we’re still unable to use this plugin anymore until it’s fixed. Fortunately this plugin isn’t critical, but it’s still something that’s going to have to sit on a todo list until then.

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Just remarking on your item #1 there, regarding “There’s no way to know that this plugin is the cause.”

    Did you get the same error as the other two above? Because it’s clearly stated in the displayed error:

    Call stack:

    current_user_can()
    wp-admin/network/settings.php:16
    include_once()
    wp-content/plugins/phoenix-media-rename/phoenix-media-rename.php:24
    include_once()

    Okay, I managed to determine that the problem started with version 2.0. The only significant difference between 1.4.0 and 2.0.0 is the settings.php file, and the Apache log concurs. This is the error:

    PHP Fatal error:
    Uncaught Error:
    Call to undefined function wp_get_current_user() in
    /.../wordpress/wp-includes/capabilities.php:660
    Stack trace:
    #0 /.../wordpress/wp-admin/network/settings.php(16): current_user_can()
    #1 /.../wordpress/wp-content/plugins/phoenix-media-rename/phoenix-media-rename.php(24): include_once('/.../wordpress...')
    #2 /.../wordpress/wp-settings.php(319): include_once('/.../wordpress...')
    #3 /.../wordpress/wp-config.php(133): require_once('/.../wordpress...')
    #4 /.../wordpress/wp-load.php(37): require_once('/.../wordpress...')
    #5 /.../wordpress/wp-admin/admin.php(34): require_once('/.../wordpress...')
    #6 /.../wordpress/wp-admin/network/admin.php(13): require_once('/.../wordpress...')
    #7 /.../wordpress/wp-admin/network/update-core.php(11): require_once('/.../wordpress...')
    #8 {main}
    thrown in /.../wordpress/wp-includes/capabilities.php on line 660

    It looks like when PMR tries to include the settings.php file, it’s getting the one in wp-admin/network instead of the one in its CWD. I tried prepending the filename in the include call with the CWD: include_once(dirname(__FILE__).’pmr-settings.php’); but that didn’t work, it resulted in the admin page loading but throwing a bigger error in the page itself instead of a WSOD error page.

    The easiest solution is to simply rename settings.php to something unique like pmr-settings.php. That works just fine. 👍

    I’m not sure why it’s getting the wrong file, why the file in the network folder has a higher priority than the plugin’s own CWD, but that definitely doesn’t seem like “bad coding out of the gate”, it seems like a bizarre side-effect of PHP and/or WordPress. 😕 (I’ll probably try to look into it to find an explanation… 🤔)

    For anyone stuck in the same situation, you can use version 1.4.0 until the latest version is fixed: https://downloads.wordpress.org/plugin/phoenix-media-rename.1.4.0.zip Or you can just rename the settings file and update phoenix-media-rename.php with the new filename. It’s a pretty quick and trivial fix.

    I also figured out to how recover the enabled state of plugins from a backup in case all of your plugins got disabled: https://wordpress.stackexchange.com/questions/371602

    Now, all that’s left to do is to try to determine what got messed up when WordPress loaded with all plugins disabled… 😕

    • This reply was modified 1 year, 4 months ago by Synetech.
    • This reply was modified 1 year, 4 months ago by Synetech. Reason: Fixed formatting. (What happened to WYSIWYG? 🤨)

    Did you get the same error as the other two above? Because it’s clearly stated in the displayed error.

    It’s not that clear in the actual log file where it’s unformatted, unwrapped, and surrounded by lots of other lines. Who has time to search a haystack for a broken needle? ¬_¬ (Well, I guess I do because I did, and then fixed the bug too. 🤷)

    Hi @crossi72
    Yes I completely understand and I think it is amazing when people like yourself are willing to perform such a task out of the goodness of your heart. It does make me curious about what commercial benefit you are getting from it. In my 10+ years background of Digital Marketing, someone would only do such a thing if it was to bring them more traffic to other services they offer. For example, theme designers would create plugins etc. However, I am happy to wait on, because it’s not of massive urgency, but I am importing images from Amazon and the files need renaming after import.
    Just as a heads up I had also installed this plugin https://en-gb.wordpress.org/plugins/shortpixel-image-optimiser/, which allows me to replace a file and it prevents the links to the image becoming broken.

    Does your plugin prevent that issue? For example, if a file is renamed do references to the original image after being renamed still work?

    However, a plugin that is a combination of the two is something I am yet to find for free, there is this paid version https://meowapps.com/plugin/media-file-renamer/.
    You see that’s the thing it causes people to jump ship to a paid version when the free ones give you problems, which is the marketing aspect.

    Hi @richardmtl thanks for the comments, I am very tempted to just re-run the whole process again because I am completely certain I couldn’t see the folder for this plugin within the WordPress plugins folder. The developer I use does tend to be cryptical but I will challenge them on it.

    • This reply was modified 1 year, 4 months ago by jaegadigital.

    @synetech thanks for sharing all that information, it is much appreciated.

    I don’t normally feel that passionate to comment as I did on this occasion but this one got to me as there is some pressure to do things as low budget as possible.

    Unfortunately, I don’t have the knowledge you do and I think I was probably making things worse in my attempt to fix the issue, and when I asked the developer to help I think they were also bailing me out of a deeper hole I had created for myself.

    I will be careful to avoid critical outbursts in the future 🙂

    Plugin Author crossi72

    (@crossi72)

    Hi all,
    everything is running fine on my development server in multisite environment, so I can’t reproduce the issue.

    I just released version 2.0.3 that contains the fix suggested by @synetech, do you have a non-critical environment to test the new plugin version?

    @jaegadigital: I don’t have any commercial benefit, I maintain Phoenix Media Rename mostly for internal use (I manage dozens of sites for my customer) and having the plugin on the WordPress repository is the best solution to update all the sites with minimal effort.
    Phoenix Media Rename is born only to resolve this basic feature that is missing in WordPress: change a file name and update every reference to the old name. I hope that someday WordPress will add this feature but most of the people doesn’t know how important it is (I am a Digital Marketing teacher in various courses in Italy, none of my students knew this basic SEO information).

    Hope that latest release will fix this problem on your multisite, let me know if I have to search for a new solution!
    C.

    Thread Starter Richard Archambault

    (@richardmtl)

    @crossi72 That fixed it for me! Marking this as resolved! Thanks, and thank you @synetech for the additional context.

    Plugin Author crossi72

    (@crossi72)

    Hi @richardmtl,
    I’m glad your issue has been resolved, thank you for notifying me of the problem, now by humble plugin has improved a little 🙂

    C.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Fatal error on Multisite’ is closed to new replies.