KC Media Enhancements

Not so long ago I’ve blogged about adding some enhancements to WordPress media management, such as inserting images with custom sizes into post and setting terms for the attachments along with individual plugins for each functionality. When I released the KC Widget Enhancements plugin, I thought I should combine those plugins into one package too. So now I present it: KC Media Enhancements.

Update
The plugin is now hosted at WordPress Plugin repo. Enjoy ๐Ÿ™‚

This plugin currently provides you with the two functionalities mentioned above which you can enable/disable easily if you have KC Settings plugin installed. You can also modify the options using the available kcme_options filter (please read the FAQ section in the readme.txt file on how to do this).

The plugin is currently hosted at GitHub and will always be updated there, but it’s also in the process of approval to be hosted at WordPress plugin repo and I will update this post as soon as it’s approved and hosted there.

Enjoy the plugin and feel free to leave a comment/bug report/ideas in the comments section below ๐Ÿ™‚

Standard

Comments

  1. I love this plugin – but with WordPress 3.4.2 I get this error:
    Fatal error: Cannot use string offset as an array in……/wp-content/plugins/kc-media-enhancements/kc-media-enhancements.php on line 97
    Any fix for this?
    Thanks,
    Nathan

  2. kucrut says:

    I think all you need to do to prevent authors from creating new categories is NOT displaying the text input field for category taxonomy. I may add a new option for this in the next version. Thank you for the idea.

  3. This is what im doing with your old plugin to prevent people to add new categories:

    function save_terms() {
    	if ( empty($_POST['attachments']) ) {
    		return;
    	}
        //print_r($_POST['attachments']); die;
    	foreach ( $_POST['attachments'] as $id => $data ) {
    			$taxonomies = get_attachment_taxonomies( $id );
    			if ( empty($taxonomies) ) {
    				continue;
          }
    
         // JOSOROMA :: BEGIN :: Save only if term exist
    			foreach ( $taxonomies as $tax ) {
    				if ( isset($data[$tax]) ) { // Choose just 1 from select drop-down
              if ( 'product' == $tax || 'color' == $tax ) {
                if ( term_exists( $data[$tax][0], $tax ) ) {
                  $_POST['attachments'][$id][$tax] = trim( $data[$tax][0] );
                }
              } else {
                $i = 0;
                foreach ( $data[$tax] as $key => $value ) {
                  if ( $i  0) {
                        $_POST['attachments'][$id][$tax] .= ',' . $value;
                      } else {
                        $_POST['attachments'][$id][$tax] = $value;
                      }
                    }
                  }
                  $i++;
                }
               // if ( term_exists( $data[$tax][$i], $tax ) ) {
                  //$_POST['attachments'][$id][$tax] = trim( join(',', $data[$tax]) );  
                 // $_POST['attachments'][$id][$tax] = trim( join(',', $data[$tax]) );
                //}
              }
    				}
          }
          // JOSOROMA :: Save only if term exist
    		}
    	}
    }
    

    I hope it helps. Thanks.