netsolution
Forum Replies Created
-
Forum: Plugins
In reply to: [My Custom CSS PHP & ADS] Update permission problemTo be more precise:
the folders
/wp-content/my_custom_css
and
/wp-content/my_custom_css/bkk
have been created, but there are no files in them, even when I click “save” on the my css settings page many times.
Forum: Plugins
In reply to: [My Custom CSS PHP & ADS] Update permission problemHi
Thanks for the update.
But as stated above I think you should use the /wp-content/uploads/ folder for the css file and backups.
Because with my server configuration (apache running as wwwrun and not the owner of the webfiles) your script can not write to /wp-content/
Warning: filemtime(): stat failed for /home/xyz/public_html/wp-content/my_custom_css/my_style.css in /home/xyz/public_html/wp-content/plugins/my-custom-css/my-custom-css.php on line 199
So that means it still does not work for me.
But I think it would work if you write to /wp-content/uploads/ because WP has write permission for that directory
Thanks
Forum: Plugins
In reply to: [My Custom CSS PHP & ADS] Update permission problemForum: Plugins
In reply to: [My Custom CSS PHP & ADS] Update permission problem// Fix no backup folder
$dirpath = plugin_dir_path(__FILE__).’_backup/’;
if (!is_dir($dirpath))
{
mkdir($dirpath, 0755, true);
}===
Line 31 is: mkdir($dirpath, 0755, true);
Forum: Plugins
In reply to: [My Custom CSS PHP & ADS] Update permission problemor maybe the backups should be placed in the uploads folder because that will always have write permission.
Forum: Plugins
In reply to: [My Custom CSS PHP & ADS] Update permission problemthe error when I open the page is:
Warning: mkdir(): Permission denied in /home/xyz/public_html/wp-content/plugins/my-custom-css/my-custom-css.php on line 31
so maybe also mkdir($dirpath, 0755, true); has to be replaced by a wp function?
Forum: Plugins
In reply to: [My Custom CSS PHP & ADS] Update permission problemHi
I tested it with your function, does not seem to work.
Can you have a look at this:
https://ottopress.com/2011/tutorial-using-the-wp_filesystem/
And also maybe it would be possible to inject the custom css code from the db into wordpress when the .css file is not there?
Forum: Plugins
In reply to: [My Custom CSS PHP & ADS] Update permission problemI think you should use
$wp_filesystem->put_contents()
Forum: Plugins
In reply to: [My Custom CSS PHP & ADS] Update permission problemI think looking at
https://codex.www.ads-software.com/Filesystem_API
could solve this, esp. “The WP Filesystem API Methodology” where tests are described to see if direct file writing permission is available or not.
Because when using the correct file writing methods from WP then if it can not write directly to file it should try FTP to write (and I have all FTP credentials in wp-config.php).
What do you think?