How to change upload directory based on frontend form input name or ID?
How to change upload directory based on frontend form input name or ID?
How to change upload directory based on frontend form input name or ID?
Check the requested URI: if(!is_admin() && strpos($_SERVER[‘REQUEST_URI’], ‘wp-login.php’) === false && strpos($_SERVER[‘REQUEST_URI’], ‘wp-signup.php’) === false) { … } But it’s probably better to use a white-list style: if(is_front_page() || is_singular() || is_archive()) { … } These 3 tags should cover pretty much all of the front-end…
This was solved as simply as: Hooking a custom .js script to the media-upload thickbox, so that it runs inside the iFrame: function admin_styles_scripts_media_upload() { wp_register_script(‘mediajs’, get_template_directory_uri().’/js/button.js’, array(‘jquery’), true); wp_enqueue_script(‘mediajs’); } add_action(‘admin_print_scripts-media-upload-popup’,’admin_styles_scripts_media_upload’); ?> Use the script to replace the default Save button with a custom one, and call self.parent.tb_remove from that: jQuery(document).ready(function() { jQuery(‘<a href=”#” … Read more
I have Something that i use from time to time when i need something like that: <?php /* Plugin Name: List User Posts Plugin URI: http://en.bainternet.info Description: lists user posts on the front end Version: 0.1 Author: Bainternet Author URI: http://en.bainternet.info */ if (!class_exists(‘list_user_posts’)){ /** * list_user_posts * @author Ohad Raz */ class list_user_posts { … Read more
You can use wp_update_post() to change the status of a post. global $current_user; get_currentuserinfo(); $post_id = $_GET[‘post_id’]; $the_post = get_post( $post_id ); if ( $the_post->post_author == $current_user->ID && $the_post ) { $the_post->post_status=”draft”; wp_update_post( $the_post ); } Use wp_insert_post() with post_status => ‘draft’ to save a post.
Create an endpoint for EP_ROOT named profile. In your callback handler use get_user_by( ‘slug’, get_query_var( ‘profile’ ) ) to find the user data. Create a template file profile.php and use locate_template( ‘profile.php’, TRUE ) to load it. In your template show the user data.
Did you check the database for the data? My guess is that the problem is here: echo ‘<input type=”checkbox” name=”cbn[]” id=”‘.$option[‘value’].'”‘,$checkboxes && in_array($option[‘value’], $checkboxes) ? ‘ checked=”checked”‘ : ”,’ /> ‘; should be: echo ‘<input type=”checkbox” name=”cbn[]” id=”‘.$option[‘value’].'”‘.$checkboxes && in_array($option[‘value’], $checkboxes) ? ‘ checked=”checked”‘ : ”.’ /> ‘; Edit: You’re confusing poor PHP. Try enclosing … Read more
The following code is taken from my “Dynamic image resize”-plugin. The plugin takes an ID as well as a string into account. I didn’t delete those lines, as they might be usable for later visitors – check the link anyway. Retrieve the image by ID or URl $hw_string = image_hwstring( $width, $height ); $needs_resize = … Read more
Taken directly form the wp_delete_user documentation: if(is_user_logged_in() && !empty($_GET[‘DeleteMyAccount’])) { add_action(‘init’, ‘remove_logged_in_user’); } function remove_logged_in_user() { require_once(ABSPATH.’wp-admin/includes/user.php’ ); $current_user = wp_get_current_user(); wp_delete_user( $current_user->ID ); } Things to note: Your code didn’t check if the user was logged in or not by the time you’re printing the remove user link, the init action has already happened … Read more
I haven’t tried the Gravity Forms plugin but if you are using the wp_insert_post function to insert the new post, you just use ‘post_excerpt’. example: $new_post = array( ‘post_title’ => ‘Post Title’, ‘post_content’ => ‘Post Content’, ‘post_status’ => ‘publish’, ‘post_excerpt’ => $custom_excerpt_field ); wp_insert_post($new_post); Not sure if I completely understand your question, so I’ve misunderstood … Read more