• I just noticed, that your plugin fills up the wp_postmeta table with numerous “_kgflashmediaplayer*” entries (12353 of 16590 entries! and I only got five videos uploaded). It seems every attachment get’s the meta data set, regardless if it’s an image or a video (or if it’s the default value).

    I took a look at the source code but then figured out, you might find the part where this happens faster than me.

    I guess somewhere there’s a check if the attachment is a video missing or not working.

    The following values are set for all images:

    “_kgflashmediaplayer-forcefirst, _kgflashmediaplayer-featured, _kgflashmediaplayer-lockaspect, _kgflashmediaplayer-encodefullres, _kgflashmediaplayer-encode1080, _kgflashmediaplayer-encode720, _kgflashmediaplayer-encodemobile, _kgflashmediaplayer-encodewebm, _kgflashmediaplayer-encodeogg, _kgflashmediaplayer-encodecustom_h264, _kgflashmediaplayer-encodecustom_webm, _kgflashmediaplayer-encodecustom_ogg, _kgflashmediaplayer-showtitle, _kgflashmediaplayer-downloadlink”

    I would suggest only saving meta data which differs from default values and maybe saving the data as one json encoded meta value.

    https://www.ads-software.com/plugins/video-embed-thumbnail-generator/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Kyle Gilman

    (@kylegilman)

    Yeah, that definitely shouldn’t happen. Certainly not on images. I’ll look in to it. I’m surprised nobody’s ever noticed it before. It’ll be a good opportunity to convert most of those meta entries to a single one. I’m a little bit hindered by my bad coding practices from when I started the project. A number of users have customized templates over the years that access some specific meta values and I don’t want to break their templates, but the ones you mentioned don’t need their own entries.

    Plugin Author Kyle Gilman

    (@kylegilman)

    I just had a look through my own databases and I can’t find any instance of those meta values being associated with images. Only videos. Do you see the plugin fields like thumbnail generating buttons and video embed dimensions when you’re looking at images in the media library? They should only appear for videos.

    Thread Starter Bjoern

    (@greencp)

    No, those fields only appear for videos. I also tried to figure out where those meta values get written but couldn’t find out yet where all of it happens. But it happens.

    I think it’s because the uploaded images don’t have a parent post.

    I could fix most meta value entries by changing the following (line 4073):

    function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
       $options = kgvid_get_options();
       if ( substr($post->post_mime_type, 0, 5) == 'video'	&& (empty($post->post_parent)
           || (strpos(get_post_mime_type( $post->post_parent ), 'video') === false && get_post_meta($post->ID, '_kgflashmediaplayer-externalurl', true) == false))

    Tha last part of the if Statement evaluates to true using only ==. Using === seems to fix it, except for one meta value: “_kgflashmediaplayer-forcefirst”. I guess this is because of a similiar bug.

    Plugin Author Kyle Gilman

    (@kylegilman)

    Ok, I see why forcefirst is being set. This is some of the oldest code still in the plugin. The quick fix would be change line 4685 to
    else { delete_post_meta($post['ID'], '_kgflashmediaplayer-forcefirst'); }

    I don’t know why that == is evaluating to true, but it obviously doesn’t hurt to change it to ===. I tested on a couple different sites and even with an image with no parents I didn’t get any of those meta fields.

    Thread Starter Bjoern

    (@greencp)

    get_post_meta($post->ID, '_kgflashmediaplayer-externalurl', true) returns an empty string if that meta value hasn’t been set. And '' == false evaluates to true. Isn’t PHP nice…

    I’ll test if I can reproduce the error with another setup.

    Plugin Author Kyle Gilman

    (@kylegilman)

    Woah! I thought get_post_meta returned false if there was no entry. The codex clearly says I was wrong. I’m sure there are a bunch of times that I made that assumption. Thank you so much for doing this careful work.

    Thread Starter Bjoern

    (@greencp)

    Ok, I just tested with another installation, and it happens there too. And it does happen with any image, not only those without parent, as soon as I edit an attachment and click update.

    Plugin Author Kyle Gilman

    (@kylegilman)

    Could be a red herring, and I think you’ve already solved most of the problems, but what screen are you in where you click update after editing an attachment? All the attachment editing I know about saves automatically without pressing any buttons.

    Thread Starter Bjoern

    (@greencp)

    It’s the edit media screen (post.php?action=edit) for editing a single attachment (the “Edit more details” link if you are using the grid view). As soon as I click on Update in the save box the meta values appear in the data base. Update returns to the edit screen.

    Plugin Author Kyle Gilman

    (@kylegilman)

    Thank you! I was testing in the newer modal windows. I can replicate it now.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘wp_postmea filling up with _kgflashmediaplayer*’ is closed to new replies.