Thread Starter
nikdow
(@nikdow)
So if the plugin is needing to update files on the webserver, that won’t succeed. We don’t allow apache to update files, as this is a major security weakness in WP. Our plugin/theme updates are done by a different server account using SVN and python.
Thread Starter
nikdow
(@nikdow)
On one of our other sites, I tested by turning the right menu off, then on again. I could see the changes on a mobile phone client OK.
The original error was
[18-Oct-2022 06:01:18 UTC] PHP Fatal error: Uncaught TypeError: ftp_pwd(): Argument #1 ($ftp) must be of type resource, null given in /home/lamp/wordpress/core/wp6.0/wp-admin/includes/class-wp-filesystem-ftpext.php:230
This error went away with the change to
if (!defined(‘FS_METHOD’)) define(‘FS_METHOD’, ‘direct’);
Hi @nikdow
We don’t have any code that update files. If you aren’t using the latest version is WordPress that checks that and if you hit the update button it will grab the latest version on the WordPress directory. We have no control on it.
So if you didn’t press any update button it should be something else since that error is showing in the WordPress admin code itself.
Try to disable the option “Enable only in mobile devices” also if you have any cache plugin try to purge its cache.
Let me know the result.
Thread Starter
nikdow
(@nikdow)
Thanks for your quick response, much appreciated.
The error is in the core but the stack trace shows the call is coming from the plugin. Sorry – I should have included the full stack trace:
[18-Oct-2022 06:01:18 UTC] PHP Fatal error: Uncaught TypeError: ftp_pwd(): Argument #1 ($ftp) must be of type resource, null given in /home/lamp/wordpress/core/wp6.0/wp-admin/includes/class-wp-filesystem-ftpext.php:230
Stack trace:
#0 /home/lamp/wordpress/core/wp6.0/wp-admin/includes/class-wp-filesystem-ftpext.php(230): ftp_pwd(NULL)
#1 /home/lamp/wordpress/core/wp6.0/wp-admin/includes/class-wp-filesystem-ftpext.php(450): WP_Filesystem_FTPext->cwd()
#2 /home/lamp/wordpress/plugins/mobile-menu/includes/plugin-settings/lib/class-mobmenu-css.php(392): WP_Filesystem_FTPext->is_dir('/home/lamp/word...')
#3 /home/lamp/wordpress/core/wp6.0/wp-includes/class-wp-hook.php(307): MobileMenuCSS->_generateMissingCSS('')
#4 /home/lamp/wordpress/core/wp6.0/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(false, Array)
#5 /home/lamp/wordpress/core/wp6.0/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
#6 /home/lamp/wordpress/core/wp6.0/wp-admin/admin.php(175): do_action('admin_init')
#7 {main}
thrown in /home/lamp/wordpress/core/wp6.0/wp-admin/includes/class-wp-filesystem-ftpext.php on line 230
As I mentioned, we’ve eliminated the error by setting
if (!defined(‘FS_METHOD’)) define(‘FS_METHOD’, ‘direct’);
which prevents WP from trying to use FTP credentials to access files. Could be reading, not updating a file.
So now we aren’t seeing any error and I can’t be sure that the above problem is in any way related to the plugin not doing anything.
I’ve tried turning off Enable only in Mobile devices as you suggested, no change.
I tried a big number in the Width Trigger, no change. Put it back to 1024px for now.
Thanks for explaining further. That happens when you save the Mobile Menu settings where we change the content of the CSS file based on the changes that were made.
The origin of the problem is the file and directory permissions that don’t seem to be the default ones that WordPress needs.
Can you try to disable Jetpack CSS functionalities or the entire plugin temporarily to see if it’s the cause of the issue?
Because the mobile menu is there but is white on a white background so you don’t see it.
In alternative add this code in Appearance -> Customize -> Additional CSS
.mob-menu-header-holder {
background: #453e3e;
}
Thread Starter
nikdow
(@nikdow)
Thanks again for quick response. I’ve added that CSS to the child theme, and it is active, but still not seeing the mobile menu. On Windows I can see the CSS is there and the
with the menu items are there, but so far I haven’t been able to work out what is stopping it from showing up.
Also, should the standard menu be hidden when the mobile menu is showing?
Thread Starter
nikdow
(@nikdow)
BTW, the reason we don’t allow PHP to update files is because this is a common vector for hacking WordPress. We only allow PHP to update/create files in the wp-content/uploads directory, and our webserver configuration won’t run any PHP scripts in that directory.
You could alter your excellent plugin to create the CSS file it needs in /uploads/WPmobileMenu/style.css for example. Or you could include this CSS in a <style> tag in the PHP output.
Thread Starter
nikdow
(@nikdow)
Thanks for your help so far. I’ve added some CSS to the theme and the menu is now appearing, but it’s empty. A screenshot: https://drive.google.com/file/d/1URYE8qbRQ05q7NAlhA8Mp9zwB2bU07Fn/view?usp=sharing
The LI items seem to be to the right of the menu area and have a zero dimension.
The CSS I’ve added is:
`.mob-menu-header-holder {
background: #453e3e !important;
}
@media only screen and (max-width:1025px) {
div.menu-header-menu-container ul#menu-header-menu {
display: none;
}
}`
Thread Starter
nikdow
(@nikdow)
I’ve switched to using Max Mega Menu (free version), which writes the CSS to the correct location:
CSS will be saved to wp-content/uploads/maxmegamenu/style.css and enqueued from there.