Support » Plugin: Uploadify Integration » [Plugin: Uploadify Integration] Doesn't work for non-logged in users!

  • I unchecked the appropriate setting to allow users who are not logged-in to upload files. However, it doesn’t work. Instead of the “Upload File” flash button, I just get a Browse button. The browse button works, but after selecting the file, nothing happens. This seems to be the same whether I check the option or uncheck it.

    I’d really like a super simple method for clients to send me files. This would be perfect if non-logged in users could upload, and if I could set a separate folder just for these files. But I’d at least like the non-logged in user option, as it’s part of the plugin’s settings, but doesn’t seem to work.

    http://wordpress.org/extend/plugins/uploadify-integration/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Have you tried integrating the WordPress uploader yourself rather than using a plugin? It’s extremely easy and I’ve always found it to be more sustainable.

    http://www.webmaster-source.com/2010/01/08/using-the-wordpress-uploader-in-your-plugin-or-theme/

    Thread Starter Tevya

    (@thefiddler)

    Nope, haven’t tried that. Looks like a little more work than I’d like to do. Plus aren’t you altering your theme or WP that way, making it so updates would erase your work?

    But it would be cool to have the new (WP 3.3) drag and drop uploader in a page for my clients! Any chance you’ll build a simple plugin or something to do what your article suggests?

    Still, this plugin is pretty slick. I just want it to do one thing it’s supposed to, and maybe get one new feature it doesn’t. Then it’s a super good solution (even if it doesn’t support drag and drop).

    The HTML:

    <input type="text" name="image" id="image" value="Whatever you want the default to be" />
    <input type="button" id="upload_image_button" value="Upload Image" />

    The jQuery:

    jQuery(document).ready(function() {
    
    	jQuery('#upload_image_button').click(function() {
    		formfield = jQuery('#upload_image').attr('name');
    		tb_show('', 'media-upload.php?type=image&TB_iframe=true');
    		return false;
    	});
    
    	window.send_to_editor = function(html) {
    		imgurl = jQuery('img',html).attr('src');
    		jQuery('#image').val(imgurl);
    		tb_remove();
    	}
    
    });

    Bearing in mind that you’ll need jQuery for this to work.

    With that in mind:
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

    Thread Starter Tevya

    (@thefiddler)

    So I put the HTML in the page, but where do I put the jQuery? Also, this won’t allow non-logged in users to upload right? It’s still limited by WP’s user roles, and non-logged in users don’t have any privileges.

    You can include the jQuery anywhere. You can give it its own file (as I do) and include it like so:
    <script type="text/javascript" src="<?php echo get_bloginfo('template_url'); ?>/js/jquery.upload.js"></script>

    The above assumes that the file is called ‘jquery.upload.js’ and is in a folder called ‘js’ in your theme’s folder.

    Or you can just include it above the HTML:

    <script type="text/javascript">
    jQuery(document).ready(function() {
    
    	jQuery('#upload_image_button').click(function() {
    		formfield = jQuery('#upload_image').attr('name');
    		tb_show('', 'media-upload.php?type=image&TB_iframe=true');
    		return false;
    	});
    
    	window.send_to_editor = function(html) {
    		imgurl = jQuery('img',html).attr('src');
    		jQuery('#image').val(imgurl);
    		tb_remove();
    	}
    
    });
    </script>

    Completely forgot about that bit, apologies. As follows:

    <input type="text" name="image" id="image" value="Whatever you want the default to be" <?php if(!is_user_logged_in) echo 'disabled="disabled"'; ?> />
    <input type="button" id="upload_image_button" value="Upload Image" <?php if(!is_user_logged_in) echo 'disabled="disabled"'; ?> />

    The above should disable the inputs if they aren’t logged in.

    Thread Starter Tevya

    (@thefiddler)

    Wait, so without it, anyone can upload right?

    I’d prefer it to be that anyone can upload. So if I use the first HTML then it’ll allow non-logged in users?

    Is it possible to specify an alternate folder to upload into?

    Yeah, the first lot of HTML will allow any user to upload a file.

    I haven’t ever had to make it upload to a different directory to be honest, I’ll take a look – there will be a way to do it, just can’t say for sure how complicated it is.

    **EDIT – What’s the page ID of the page that the form is included on? There’s a quick way that I’ll be able to do it specifically for that page.

    **EDIT 2 – The following should do the trick:

    if($page->ID==1)
        $dir = WP_CONTENT_DIR . '/the-folder-you-want-them-to-go-to';

    That goes in /wp-includes/functions.php in the wp_upload_dir() function, after the $main_override variable.

    Just change the 1 to whatever the page ID is.

    Thread Starter Tevya

    (@thefiddler)

    Okay so this looks super cool. And I appreciate your effort. But I have 2 hesitations: 1) I don’t want it loading the header stuff to load on every page of my site and 2) I’d rather not go and manually add it to my theme, only to have it overwritten next time my theme updates.

    Any chance you’d just build a plugin with this? I know that’s more work for you than letting people insert it as you show here, but it would make a great alternative to Uploadify Integration and have drag and drop!

    You’d only need a few options for the settings: logged-in only vs logged out users, folder where you want the files saved, and possibly list of page ID’s that you want it to load on (and/or have the user insert a shortcode for it). Just an idea. Would do it myself if I were a developer. Unfortunately I’m not. If you do go for it, I’d be happy to help with testing, etc!

    Seems like quite a few people use a plugin that does this for them.

    Yeah, sure. I will see what I can get done tomorrow during the day. Shouldn’t actually be too hard.

    I’ve only ever made plugins for clients at work, so this could be my first public plugin!

    Will get back to you on this when I’ve made some progress.

    Thread Starter Tevya

    (@thefiddler)

    Awesome! I’m way excited to try it out, once you’ve got it finished.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: Uploadify Integration] Doesn't work for non-logged in users!’ is closed to new replies.