Hi there, I've got a client who wants people to be able to upload video files that would automatically get posted on a page of the site. Is this possible?
Hi there, I've got a client who wants people to be able to upload video files that would automatically get posted on a page of the site. Is this possible?
Yes, it's possible but you would have to configure your form and your theme properly to do this. You would use the Post Fields to create a Post. For the video you would use a Post Custom Field set to a File Upload field type. You would then have to modify the theme so that it would display that custom field type as a video, meaning you would need to know how to embed a video player with the path to that video being pulled from the Custom Field value that you configure the form to create.
I just did this in response to another forum post. With oEmbed support in WordPress, it's pretty easy to do (if you enable the automatic embedding in Options > Media):
No modifications to any theme templates at all.
Thanks Chris.... my client needs a little bit more functionality than this. They need all videos uploaded to be private and not viewed by anyone but their staff (I currently have Wishlist Member set up on their site, so adding another page that is private is doable) They also want to be able to select a category of the video within the form so that it gets uploaded to a specific page just for that category. Do you see an easy way of doing this with YouTube or Vimeo (with privacy?) If not, can you recommend anyone who can help me out with this?
Not sure if this is the right topic to post under, there seem to be so many about changing the upload paths. My issue is just a bit different. I actually have gotten the upload path changed via your hook in my functions.php file. BUT, it's still uploading to the default gravity forms uploads folder.
What I've got is a form set up that uses a File Upload field for a video, then using the Content Template and the Body field, I have included the JW Player embed code. In the section that calls the file to be played, I have included the Video Upload field tag so that this would be generated dynamically based on the file name of the video that the user uploads.
This is how I know the upload path was successfully changed, because when it creates the post the code in the post comes out exactly as it should and it DOES look for the video in the upload path I have specified, which is giving me a 404. When I look at the FTP, the video is being uploaded into the Gravity Forms upload folder instead of the one specified. Looks like it should be working perfectly, no errors so I'm not sure what to change. Any info appreciated.
Click play on the video and you will see the error message. The file URL was generated from the tag in the body field of the form.
http://www.waylaydesign.com/newsgaggle/gravity-form-video-submission
Same thing:
http://www.waylaydesign.com/newsgaggle/gravity-forms-submission-2
My Content Template using the Body field:
<script type='text/javascript' src='http://www.waylaydesign.com/newsgaggle/jwplayer/jwplayer.js'></script>
<div id='mediaplayer'></div>
<script type="text/javascript">
jwplayer('mediaplayer').setup({
'flashplayer': 'http://www.waylaydesign.com/newsgaggle/jwplayer/player.swf',
'id': 'playerID',
'width': '480',
'height': '270',
'file': '{Choose Your Video:1}'
});
</script><br />
{Tell Us About Your Video:2}
My Upload Path code in functions.php of my theme:
add_filter("gform_upload_path_5", "change_upload_path");
function change_upload_path($path_info){
$path_info["path"] = "public_html/newsgaggle/jwplayer/uploads/";
$path_info["url"] = "http://waylaydesign.com/newsgaggle/jwplayer/uploads/";
return $path_info;
}
My test form: Because the upload path can only be changed per form and not field, I created the video form separately at the bottom of this page, so you can ignore the top form. I wanted to keep my image uploads where they were, but the JW Player will not access the videos from within the Gravity Forms uploads folder. If it did I would be fine with that.
http://www.waylaydesign.com/newsgaggle/submit
If you need any additional info let me know. Thanks.
Nevermind. SMH. Found my problem. Works perfectly. You can remove my comment if you like. Thanks. The problem was my upload path and that "public_html/newsgaggle". Changed it to just "jwplayer/uploads" and does the trick.
Note to self: When a problem causes several hours of anguish, walk away and come back with fresh eyes.
We're very happy you were able to resolve that. I'll leave your comments as they may be helpful to someone else going through the same thing.