• I would love to have only one button (no undo / update profile / success msg divs) choose image, that after the user has chosen an image, auto refreshes the page so they can see the newly uploaded image.

    Using css, I can hide most of the features I don’t want, (preview, btns, etc), but is it possible to auto submit the form after they choose an image from the media uploader select button?

    I’ve made a lot of different attempts with jQuery, but can’t seem to trigger the form submission from the select button.

    thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support Daniel Tara

    (@danieltara)

    I’m assuming this is for the [avatar_upload] shortcode and not for the admin user profile. This snippet should do it:

    wp.media.wpUserAvatar.frame().state('library').on('select', function() {
    	jQuery('.wpua-edit input[type="submit"]').click();
    });
    
    Thread Starter loxx927

    (@loxx927)

    Hi Daniel,

    Yes, I should have been more specific, from the [avatar_upload] shortcode. I will give that a try and report back, thanks so much!

    Thread Starter loxx927

    (@loxx927)

    Hi Daniel,

    Well that worked like a charm. Thanks so much for that snippet! However I have one more related issue.

    The select button submits the form just fine, however it doesn’t automatically update the image. In order to get the image to actually show up on the profile, I have to do the following:

    1) Reload the page, (via the reload page button in FF) which produces a 400 bad request error.
    2) Visit another page on the site
    3) Re-visit the profile page
    …New image shows up. Obviously not ideal.

    Since .click functions don’t have a callback function associated with them, I’m not able to stick the reload command in a callback, so have experimented with the following:

    wp.media.wpUserAvatar.frame().state('library').on('select', function() {
    			jQuery('#wpua-edit-1 input[type="submit"]').click();
    			 setTimeout(location.reload(), 1000);
    		});
    

    however this interferes with the form being submitted. I’ve also tried breaking out the reload command into a separate function like so.

    wp.media.wpUserAvatar.frame().state('library').on('select', function() {
    			jQuery('#wpua-edit-1 input[type="submit"]').click();
    			reloadPage();
    		});
    	}
    });
    
    function reloadPage() {
    	setTimeout(location.reload(), 1000);
    }

    …Still no good, database doesn’t seem to get updated with new image. So if you have any thoughts on what I’m missing here to be able to reload the page so the user can see the new image on their profile page immediately, I’m all ears ??

    Thanks Daniel!

    Plugin Support Daniel Tara

    (@danieltara)

    The page should reload when the form is submitted. If it doesn’t it’s because another plugin or the theme is interfering with its behavior. Is there a link I can look at?

    Thread Starter loxx927

    (@loxx927)

    Hi Daniel,

    Yes, I can supply you with a link, however as the page this is on is a user profile page, and only logged in users would actually see this page, I’ll need to setup a test account for you to try out.

    I’d prefer not to share that info via a public forum, is there an email address I can reach you at?

    thanks,
    ~Nick

    Plugin Support Daniel Tara

    (@danieltara)

    You can send me a private message here. Please also reply to this topic once you do because messages through that contact form sometimes land in the spam folder. Thanks

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    @loxx927 Please don’t offer to send or post logon credentials on these forums:

    https://www.ads-software.com/support/guidelines#the-bad-stuff

    You can contact the author on their own site and, once there, the discussion is between the two of you. However, it is not OK to enter or send site credentials on these forums. We don’t want to encourage others (who are less reputable) to do similar things. It’s a fine line, but one that we need to enforce. Thanks for your cooperation.

    Thread Starter loxx927

    (@loxx927)

    Hi Daniel,

    I just sent you a detailed email via the above site. Thanks so much for your help!

    Thread Starter loxx927

    (@loxx927)

    @sterndata

    Hi Steven,

    I had no intention of doing that, hence why I was asking for an alternate method of contacting Daniel, but I appreciate that you guys are watching out for us. ??

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    We just don’t want the practice normalized.

    Plugin Support Daniel Tara

    (@danieltara)

    @loxx927 I’m afraid your email didn’t go through. I checked all the folders. Can you send it again please? Alternatively you can message me on Facebook.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Submit form from Media Uploader’ is closed to new replies.