Customize the upload screen

You will need to hook into attachment_fields_to_edit and unset them for a role. You can use current_user_can(‘author’) http://codex.wordpress.org/Function_Reference/current_user_can Example to remove image alt field function remove_caption($form_fields) { if (current_user_can(‘author’)){ $form_fields[‘image_alt’][‘input’] = ‘hidden’; return $form_fields; }} add_filter(‘attachment_fields_to_edit’,’remove_caption’, 15, 2); My initial post used unset but I tried it and it did not work, from the example … Read more

User File Upload Repository?

There are plugins that will let you do this. http://wordpress.org/extend/plugins/user-files/ http://wordpress.org/extend/plugins/wp-filebase/ Whatever you decide though keep in mind security when doing things like this. You don’t want people going crazy and uploading huge files either, so check the plugins have built in restrictions on what can be uploaded and that they are in active development.

Creating a multi-file upload form on the front end for attachments

This may not be the most elegant way to do it (I’m not sure if overwriting the $_FILES global is even allowed) but this seems to work: global $post; if ($_FILES) { $files = $_FILES[‘upload_attachment’]; foreach ($files[‘name’] as $key => $value) { if ($files[‘name’][$key]) { $file = array( ‘name’ => $files[‘name’][$key], ‘type’ => $files[‘type’][$key], ‘tmp_name’ … Read more

How can you upload an image from within a settings page?

WordPress provides a convenient function for just this purpose: wp_handle_upload(). Assuming that you already have the appropriate file form field in your settings page, and that you’re using register_setting() for your options, and therefore already have an options validation callback, simply handle the file form field data using wp_handle_upload(). Here’s an example: <?php // Validate … Read more

Possible to create placeholder images in WordPress editor that are clickable (should bring up uploader)?

such an answer would likely become unworkable/unusable after a WordPress update, as TinyMCE get updated and APIs change – by @TomJNowell While I agree with Tom, there still an be a general answer that explains the general concept and the parts that aren’t moving. The PHP plugin to set the default content First there has … Read more

Modify image while uploading

this is how I’ve done it preg_match(‘/\.[^\.]+$/i’,$file[‘file’][‘name’],$ext); $name = md5(time().$user_id.rand( 5, 97)); $name_one = $name.$ext[0]; $name_blur = $name.’_blur’.$ext[0]; $file[‘file’][‘name’] = $name_one; $upload = wp_upload_dir(); $uploaded_file = wp_handle_upload( $file[‘file’], array( ‘action’=> ‘bp_upload_profile_bg’ ) ); //if file was not uploaded correctly if ( !empty($uploaded_file[‘error’] ) ) { bp_core_add_message( sprintf( __( ‘Upload Failed! Error was: %s’, ‘buddypress’ ), … Read more

Image resize with image url

u can use this: function wpse128538_resize($url, $width, $height = null, $crop = null, $single = true) { //validate inputs if (!$url OR !$width) return false; //define upload path & dir $upload_info = wp_upload_dir(); $upload_dir = $upload_info[‘basedir’]; $upload_url = $upload_info[‘baseurl’]; //check if $img_url is local if (strpos($url, $upload_url) === false) return false; //define path of image … Read more

Disable TinyMCE Drag and Drop

you can solve this problem by enqueue the following script with the dependency of jQuery jQuery(document).ready(function(){ tinyMCEPreInit.dragDropUpload = false; }); To add the dependency you can refer this link I have tested this solution and it has worked for me. I hope it will work for you too.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)