PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Adding field using PHP, not "Edit Form" page

  1. First of all, what I'm trying to accomplish is for a user to be able to insert a "Post Title", "Post Content" and then upload an image. My client would like to allow the user to resize images through some means. I'm going to use the same modal box WordPress uses in the backend for users to upload the image. However, this requires me to insert my own field that can't be added using the GF backend.

    There don't seem to be any hooks allowing insertion of HTML/PHP in the form for the user to see and edit. One way I thought about doing it was using the hook for the submit button, adding in the HTML above the submit button and having my own custom submit button. This should work, right?

    The form would look like:
    - Post Title
    - Post Content
    - Empty text field (to be populated with photo URL after uploaded -- will be done using GF)
    - Button to launch the modal box to upload photo and popular text field

    The problem with that is that the button is restricted to the div that the submit button is in, so I can't position it to be near the text box.

    Is there any other solution I can do for this? The button doesn't need to be special. Just has to have an ID that I can select using jQuery.

    Thanks,

    Andrew Ryno

    Posted 14 years ago on Thursday November 18, 2010 | Permalink
  2. Took another look at all the field options and my eyes must have glazed over the 'HTML' option. Just added my HTML in there and got it fixed.

    Posted 14 years ago on Thursday November 18, 2010 | Permalink
  3. u4eadesign
    Member

    Would you mind posting the code for resizing an image? I need to make sure uploaded images are no larger than 620px wide.

    Posted 14 years ago on Thursday December 30, 2010 | Permalink
  4. An easy way to constrain the uploaded image size is via a plugin like the "resize at upload" plugin.

    http://forum.gravityhelp.com/topic/can-i-edit-image-dimensions-after-users-has-submitted-image-and-form#post-13896

    Posted 14 years ago on Thursday December 30, 2010 | Permalink
  5. u4eadesign
    Member

    Thank you! Also.. I may have missed this.. how do you get an uploaded post image to actually show up in the post? Does it happen automatically or do you need to manually add code to the post? I see the image in the Form Entries in the Admin, and the image is also in the gallery for that particular post.

    I am having a server (I think) issue with post images in general so that might be what is causing the problem.

    Posted 14 years ago on Thursday December 30, 2010 | Permalink
  6. u4eadesign
    Member

    Is it possible to get the uploaded post image into the Thesis field for post image?

    Posted 13 years ago on Friday December 31, 2010 | Permalink
  7. I am also looking for this answer, I need the submitted image which was uploaded via post image to actually also automatically post with the post content. How do I manipulate things to make that happen?

    Posted 13 years ago on Saturday January 1, 2011 | Permalink
  8. How does Thesis store the post image? Is it stored as a custom field?

    Posted 13 years ago on Monday January 3, 2011 | Permalink
  9. Carl,
    In my case, I am using Builder Themes by iThemes. Images are stored in my Media. It shows up in the gallery when I open the post (edit post in wp-admin) that was submitted via the form but I have to manually insert the images. I would like the images to be able to automatically be inserted into the posts. Also curious how to give the user who is submitting the form the choice of inserting the image with a left, center and right alignment choice.

    Thanks in advance!
    Krry :)

    Posted 13 years ago on Monday January 3, 2011 | Permalink
  10. @Kerry if you want the images automatically inserted into the post body content of the post that is created you can use the Content Template functionality of the Post Body field. Edit your form, edit your Post Body field and one of the options is to enable a content template.

    Once you enable the content template option, it will display a textarea and insert field value drop down. It works like the confirmation text and the notification email text, you can insert form field values and format the post body output.

    WHATEVER you put in the content template is what will be used for the Post Body content itself. So you need to be sure to select the Post Body field itself in the Insert field value drop down if you want to include the user submitted value for the Post Body.

    You can insert the value of your image fields using the Insert form field drop down on the content template.

    For example see this screenshot which shows an example:

    http://grab.by/8bji

    Please note form field variables are specific to each form so you can't use the exact same values, which is why the Insert form field value drop down is provided.

    Posted 13 years ago on Monday January 3, 2011 | Permalink
  11. u4eadesign
    Member

    Carl,
    Yes Thesis has it's own custom field called "Post Image"

    The other instructions worked for me (using the content template), but ideally I'd be able to get the image into Thesis' custom field, then it will show up with a thumbnail like all my other posts

    Posted 13 years ago on Monday January 3, 2011 | Permalink
  12. Gravity Forms v1.5, which is a development release, includes support for content templates on Post Custom Fields. So what you can do is the same thing you would do with the Post Body, but with a Custom Field value.

    You would have to know what the post image custom field key that Thesis uses and use that when setting up the Custom Field. I'm also not sure how Thesis handles sizing the thumbnail... so that may be an issue.

    Posted 13 years ago on Monday January 3, 2011 | Permalink
  13. Thanks, that is in fact what I was searching for. Works great.

    Posted 13 years ago on Thursday January 20, 2011 | Permalink

This topic has been resolved and has been closed to new replies.