Using Image insert control in code
The Image Widget plugin uses the media uploader. You may want to look at its code source. It is very simple.
The Image Widget plugin uses the media uploader. You may want to look at its code source. It is very simple.
For the part of opening a lightbox, browse for something and then performing something on an action within: WordPress has this already build in. For what you ask is basically the thickbox that opens up like in the post editor when you browse for an image in the gallery. You find all the code you … Read more
To get the “Use as featured Image” link you have to pass post_id to the media-upload.php file with the url so the request will be changed to: var post_id = 234 // retrive the post id via php var request = url.media_upload+’?post_id=’+post_id+’type=image&TB_iframe=true’; Make sure you add the post_id very first of the url. It didn’t … Read more
Two options: Hook into ‘wp_handle_upload’, a filter provided by the function wp_handle_upload() in wp-admin/includes/file.php: apply_filters( ‘wp_handle_upload’, array( ‘file’ => $new_file, ‘url’ => $url, ‘type’ => $type ), ‘upload’ ) Replace the new file URI with your remote URI. The function wp_insert_attachment() in wp-includes/post.php offers two actions: do_action(‘edit_attachment’, $post_ID); do_action(‘add_attachment’, $post_ID); You can get the attachment … Read more
That’s a server permission problem. According to the WP docs: Any file that needs write access from WordPress should be owned or group-owned by the user account used by the WordPress (which may be different than the server account). For example, you may have a user account that lets you FTP files back and forth … Read more
This is not full solution, it’s only a direction for you to work with media uploader Firstly, you need to know how to implement Media Uploader in your plugin/theme. You can learn that from the file: wp-admin/js/custom-background.js which is used by WP for custom background page. If that’s too hard to understand, then read this … Read more
There must be something identifiable about your form data, such as your input names. Check for one or more of those and process accordingly. function custom_upload_dir($args) { if (isset($_POST[‘something’])) { $args[‘path’] = $args[‘basedir’] . “/mypath” . $args[‘subdir’]; $args[‘url’] = $args[‘baseurl’] . “/mypath” . $args[‘subdir’]; } return $args; } After some investigation, the only things I … Read more
See my question and answer again, you linked it already in your question: simple solution for restricting access to (some) uploads/downloads The solution isn’t that hairy the only necessity – besides configuring the plugin correct – is to create a .htaccess, which you could do programmatically. For that you have to automate the creation of … Read more
have you tried by setting the second argument of wp_signon() to true or blank? set false will prevent wp_signon() from setting secure cookie which is essential for accessing wp-admin if your using ssl. i have tested and $user = wp_signon( $user_data, true ); works as expected.
I’m copying a previous answer here as I think it will help. What this will do is whenever the media library pops up, instead of showing all media for a given post it will filter down to only images attached to the post. You could paste this right into your functions file: /** * Media … Read more