PhPCentre
Forum Replies Created
-
This did not affect previously uploaded files.
I am assuming your previously uploaded files are still served by their s3 urls, but your newly uploaded files are not. So I need your to check your postmeta table using a post_id of any one of your newly uploaded attachment and see when there is a row in the table for that file with meta_key ‘amazonS3_info’.
but one of the other admins might have.
Also is this a multi site install?.
I have not used the EWWWW plugin, but I managed to go through the files, and yes the plugin is also using the filter
wp_update_attachment_metadata
. I also noticed the plugin is making calls to the s3 plugin inside this particular filter with a priority number 15 but yours is 20.// file common.php line:1571 if ( ! preg_match( '/' . __( 'Previously Optimized', EWWW_IMAGE_OPTIMIZER_DOMAIN ) . '/', $meta['ewww_image_optimizer'] ) && class_exists( 'Amazon_S3_And_CloudFront' ) ) { global $as3cf; if ( method_exists( $as3cf, 'wp_update_attachment_metadata' ) ) { $as3cf->wp_update_attachment_metadata( $meta, $ID ); } elseif ( method_exists( $as3cf, 'wp_generate_attachment_metadata' ) ) { $as3cf->wp_generate_attachment_metadata( $meta, $ID ); } $ewww_debug .= 'uploading to Amazon S3<br>'; }
So the ewww plugin is triggering upload of files to s3 by itself,if the s3 plugin is installed, and I think this is the reason for the issue. So change your priority to 14 or less because your filter needs to run first before the ewwww filter and then test with a fresh upload and report your results.
Where exactly did you insert the codes in your theme’s functions.php file?..
The codes are working on my end. Did you turn on the path option in the plugin settings page and also the year/month folder turned off?..
The codes are working on my end. Did you turn on the path option in the plugin settings page and also the year/month folder turned off?..
Sorry for the delay, was a little busy with stuff. So this is what you should do,insert the below code in your function.
function wp_update_attachment_metadata_s3( $data, $post_id ) { $parent_id = get_post_field( 'post_parent', $post_id ); $type = get_post_type( $parent_id ); $path = ''; switch ($type) { // the rest of your codes...
Also make sure the plugin settings has path — turned on — , year/month — turned off —
I need to understand properly what you are trying to do. Are you trying to set dynamically the s3 upload path of an image file uploaded from the edit page/post screen using the set featured image link?…
I think you have the filter
wp_update_attachment_metadata
mistaken. That filter is used for image attachment only.Yes that is meant to be the case, the different image sizes are used by wordpress in the appropriate places. For example, the image size used by wordpress in the media library list page is different from the size used in the edit media page, and sometimes different from the image size wordpress inserts inside pages/posts depending on the original image size.
but then I check Amazon and I have multiple variations of the same image
Do you mean thumbnails?.
Forum: Hacks
In reply to: Link to date_query results in WordPressYou need a custom query var..
https://www.rlmseo.com/blog/passing-get-query-string-parameters-in-wordpress-url/Forum: Hacks
In reply to: Adding the datepicker in events pluginWhen working with js always use the browser console to help detect errors in your code. Change your js code to this:
(function($) { $( "#date" ).datepicker(); })( jQuery );
or this:
jQuery(document).ready(function ($) { $( "#date" ).datepicker(); });
And one more thing, I would suggest loading your custom script only on your plugin page(s), your code will always include your custom js code on all admin pages. And let say we have an input field with the id date on another admin/plugin page , your code will trigger a ui for that the input field too.
Forum: Hacks
In reply to: Prevent users from changing e-mail addressThanks to you too, so can you mark this issue as resolved please..
Forum: Hacks
In reply to: Prevent users from changing e-mail addressThe codes I gave you are working on my end
and made the change in my function.php child page
Do you mean child theme, where did you insert the codes I gave you, inside the parent’s functions.php or the child’s ?
Anyway, I managed to insert the whole stuff inside a simple plugin. Please download it here activate and again report your results.
Forum: Hacks
In reply to: Prevent users from changing e-mail addressThe codes I gave you are working on my end.
and made the change in my function.php child page
Do you mean child theme,where exactly did you place the codes in the parent fucntion.php or the child’s.
Anyway ,I did manage to put the whole stuff inside a simple plugin. Please download it here install and again report your results.